CMS Development

John
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Using new modules (beta) with export to template context

I have a new module in an html template:

{% module "module_1523278198164351" module_id="1234567" label="Header" export_to_template_context=true %}

 

I am converting an old template. In the past I used something like 

{# call custom module #}
{% custom_widget "header_settings" widget_name='Internal Custom Module Name', label="Header Settings", no_wrapper=True, export_to_template_context=True %}
{# call value from module in the template with widget_data #}
{{ widget_data.header_settings.layout }}

 

I have searched and searched for updated documentation on this and haven't found anything. I have tried

{{ widget_data.module_1523278198164351.layout }}
{{ module.module_1523278198164351.layout }}
{{ module_1523278198164351.layout }}
{{ content.modules.module_1523278198164351.layout }}
{{ module_data.module_1523278198164351.layout }}

 

 All of this to no avail. Please help! 



I like kudos almost as much as cake – a close second.

0 Upvotes
8 Replies 8
benvanlooy
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Using new modules (beta) with export to template context

Hmm, what exactly are you trying to do?

 

> Are you trying to display a module in the template?

> Are you trying to display a certain value from that module in the template?

 

// Edit // sorry replied to early..

 

Have you found a working solution yet?

 

 

0 Upvotes
John
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Using new modules (beta) with export to template context

I am trying to display a set of values from the module in an html template.

I haven't found a solution to display default values except to set variable fallbacks - which bloats the code and shouldn't have to be done.



I like kudos almost as much as cake – a close second.

0 Upvotes
Hawk-Steve
Top Contributor

Using new modules (beta) with export to template context

Sorry for reviving an old post here, but I've been looking for a solution to this too.

 

Was a solution ever found for this John? Would be very interested to see how you got on. Unfortunately, I found myself in a loop of 3 developer pages!

0 Upvotes
benvanlooy
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Using new modules (beta) with export to template context

Have you tried checking out the Developer Info to see if you can find what you want there?

 

Otherwise - I don't know - I guess you should contact support & keep your fingers crossed someone helpful answers your ticket 😕

 

 

0 Upvotes
edjusten
HubSpot Employee
HubSpot Employee

Using new modules (beta) with export to template context

Hi @John Working with our dev team here, your first solution should be the one that works: 

 

{{ widget_data.module_1523278198164351.layout }}

but there may be something specific to your templates causing it to fail. Can you provide an example? 

 

Thank you,

Ed Justen


Did my post help answer your query? Help the Community by marking it as a solution
0 Upvotes
John
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Using new modules (beta) with export to template context

Hey @edjusten, support recommended that I wait for you to answer Smiley Very Happy

Any thoughts?



I like kudos almost as much as cake – a close second.

0 Upvotes
edjusten
HubSpot Employee
HubSpot Employee

Using new modules (beta) with export to template context

Hi @John  Still looking into this. Apologies for the delay. Please check you PMs for futher info.

 

Ed 


Did my post help answer your query? Help the Community by marking it as a solution
0 Upvotes
John
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Using new modules (beta) with export to template context

Hey @edjusten, thanks for your reply. See below.

 

I created a new email template with HS's standard starter code. Then I added a module:

{% module "module_152330467297942" module_id="[the_module_id]" label="Better Vertical Spacer" nowrapper=True, export_to_template_context=True %}

 

Then I tried to call the value that I wanted:

{{ widget_data.module_152330467297942.set_height.number_value }}

 

It did not show in the design manager. Interestingly enough, even though the module field has a default value, the template does not read it. After I:

  1. published the template
  2. used it in the email editor
  3. opened the module
  4. changed the default value to something different
  5. saved the module in the email editor

...then the email editor showed the value.



I like kudos almost as much as cake – a close second.

0 Upvotes