Using a module inside a custom module

andreasmb
Contributor

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 Upvotes
2 Replies 2
roisinkirby
HubSpot Product Team

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

0 Upvotes
andreasmb
Contributor

Hi!

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

0 Upvotes