Problem while adding modules using snippets

Occasional Contributor

 Hello everybody,

 Need your help here...

 One problem that I have is that I am trying to include html module in another html module (Not Drag&Drop) Hubspot says:

"This module can be added to any drag and drop template via the Add sidebar. It can be added to HTML/HubL templates using the following snippet" and gives me usage snippet...

  

When adding this thing errors happen:

 
 -- Cannot resolve property "module"
 -- 'module' is disabled in this context
 
What am I doing wrong?...
 
And one other question:
 
If I try to locate a module inside a module like this, how do I make so that when editing a template of this website, this module had an option of adding multiple module of this kind ? 
Thanks a lot 

 

Reply
0 Upvotes
4 Replies 4
Highlighted
Advisor | Partner

@Tornike 

 

Could you provide us with any code that you've tried thus far?

Reply
0 Upvotes
Highlighted
Regular Advisor | Platinum Partner

Hi @Tornike ,

 

You has copy the snippet of module to paste in another? In your module, copy the snippet to paste where you need in your template. Look:

 

templates (1).PNG

 

Did this post help solve your problem? If so, please mark it as a solution.

Best regards!

Reply
0 Upvotes
Highlighted
Occasional Contributor

Thanks for response Daniel, 

That's what I am trying to do, copy that snippet which you indicated and then paste it in another module. It causes the error which I mentioned above.

I'm looking for ways to make this work and get rid of the error...

Any ideas?...

Oh and happy new year btw  : )

Reply
0 Upvotes
Highlighted
Advisor | Partner

Hey @Tornike 

 

So it seems that even though the official documentation says that using modules inside of other modules is a supported function, the error  "'module' is disabled in this context" and older community posts are showing that this is no longer the case.

 

So a potentially grueling solution would be to mimic the 'child' module's authoring experience (data input), functionality, and markup/styling into the 'parent' module.

 

EDIT:

I said grueling but if structured correctly this could lead to a much more fluid and effecient authoring experience!

 

If the purpose of embedding modules in modules was to share a variable, I would take a look at export_to_template_context as this could be the parameter thats saves you a lot of time.