Hi. Can you suggest how resolve my problem? I make two custom HUBL+HTML modules. In one of them I have text field "clickerName" in which I put some value from visual editor. I want to access to this value from other custom module. Any suggestions?
I know this converstation is some weeks old but I find it really interesting, so I wanted to share my experience with something similar in case it helps someone who sees this topic.
From my experience, if the pages where you have the modules are somehow connected (loading partial templates from another template, for example), I would suggest using one "global module" in your main template so you can access the data from another partial template without the need of more modules.
There are also other solutions to share data between templates, like using macros or a "config file" with a list of properties (for example in JSON format) and they might be more efficient, but this is completely up to you
@alyssamwilie recently answered another question and the solution might be something you could implement. She used HUBL to add data to a JS global, from which it can be used anywhere on the page.
@Kevin-C - wouldn't you need to know the ID of the module to be able to traverse the widget_data dict from another module? Wouldn't there be a lot of "hard-coded-ness" involved in that approach? I haven't used the export_to_template_context for anything other than HUBL templates so I'm excited to see your approach to the problem.
could you please share more context about the issue you are having? If you could share a screenshot will be perfect. With this information, our experts will be able to help. I will tag so they will be able to advise you.
Hi @Silent2000 - Modules are meant to be descrete and it is not recommended that modules share information in that way. This helps modules get published in the marketplace be descrete and not have to have dependecies of other modules.
If you would like to tell us what you're trying to accomplish, maybe we can help you with the approach instead of sharing data between modules.