Passing data between modules used in the same template, global variables
Aug 14, 2018 4:46 AM
I would like a custom module to set a variable that would be visible for whole template that is using the module.
- A custom module with Google Maps element including all the data for the map
- Another custom module that creates a Google Map element
- A template calling one or multiple custom modules with Google Maps elements
- A template without any of those modules
- A partial (footer) that is included in every template with JS code that calls Google Maps API and JS init function
What I would like to achieve is to have the JS code for Google Maps only when module that creates a map element is used in the template. Any ideas?
I thought that setting a variable inside the map module that the footer can detect would be perfect, but of course the variable is not visible outside the module.