CMS Development

andreasmb
Contributeur

Using a module inside a custom module

Hi there,

 

I'm making a custom module that contains a snippet of HTML in a module:

{% widget_block raw_html "my_content" overrideable=False, label='This is some HTML', no_wrapper=true, export_to_template_context = true %}
  {% widget_attribute "value" %}

<div>some html I want to display</div>

  {% end_widget_attribute %}
{% end_widget_block %} 

Trouble is, when I call this module, a number gets appended to the module name (I think it's the ID of the custom module).

 

I'd like to get my module like this:

 

{{ widget_data.my_content.value }}

 

... but instead, I'll have to call it like this:

{{ widget_data.module_1486770875357684_my_content.value }}

But this doesn't work, because the custom module ID varies by page!

Does anyone know a workaround for this?

This help article talks about the problem, and claims that "you may instead choose to use no_wrapper=True, when printing HubL module values within custom modules." However, this does not seem to make a difference.

0 Votes
3 Réponses
roisinkirby
Équipe de développement de HubSpot
Équipe de développement de HubSpot

Using a module inside a custom module

Hello @andreasmb are you still experiencing this issue? Can you share a link to the preview/live page you are working on?

0 Votes
AArnold3
Membre

Using a module inside a custom module

I'm having this issue too but the solution is not posted. Where can I find the solution?

0 Votes
andreasmb
Contributeur

Using a module inside a custom module

Hi!

Yes, this was actually marked as resolved, but it seems like the answers have disappeared... weird.

0 Votes