Hi there, I am working on my first Hubspot project ever so my apologies if I am missing something major here! I’ve spent a fair amount of time in the docs and am just not making any progress. I want to emulate a custom post type for event data so I made a new blog called events and have a custom module (event_single_module) applied to the event blog template that collects data (time, location, etc) on each event. The purpose of the event blog is not to be seen on the site, but to store the information so it may be used in other front-end modules. This module is working just fine.
For viewing event data on the front end, I set up another custom module called event_picker_module. It takes a comma-delimited list of blog post IDs from the events blog, loops through, and gets details on each using the blog_post_by_id function. I have no problem getting a title from each blog post, so I know my loop is working okay. However, I am having trouble reaching and displaying the custom module data in the event_single_module for each post. I have read that getting data from a custom module within another template can be difficult and was able to find the unique custom module name in the JSON tree (module_153244861705268) and try that out (as is suggested here) with no success. It seems as though adding the export_to_template_context parameter to a module tag may be the missing link, but since I am troubleshooting within module files and not template files, I am not able to add a module tag without an error firing. Either that or I am just targeting incorrectly. Does anyone have ideas on how I can reach and use the event_single_module data in the event_picker_module? I will post the relevant code for each module below. Thank you very much for the help!
event_single_module
<div class="event-single">
<div class="inner">
<h2 class="event-title">{{ module.event_title }}</h2>
<p class="date">
{% if reoccurring %}
{{ module.reoccurring_date }}
{% else %}
{{ module.event_date }}
{{ module.start_end_time }}
{% endif %}
</p> <!-- .date -->
<p class="location">{{ module.event_location }}</p>
<p class="description">{{ module.event_description }}</p>
{% if module.event_type_choice == 'eventbrite' %}
<a class ="eventbrite-link" href="{{ module.eventbrite_link }}">View on Eventbrite</a>
{% elif module.event_type_choice == 'contact' %}
<a class ="contact-link" href="mailto:{{ module.contact_link }}">Contact Coordinator</a>
{% endif %}
</div>
</div><!-- .event-single -->
event_picker_module
{% for eblock in module.event_block %}
<div class="event-block">
{% if eblock.event_block_title %}
<p class="event-block-title">{{ eblock.event_block_title }}</p>
{% endif %}
{% set events = eblock.event_ids %}
<div class="event-table">
{% for id in events|split(',') %}
{% set current_event = blog_post_by_id(id) %}
<div class="event">
<p class="title">{{ current_event.title }}</p>
<!-- want to access custom module data for events here! -->
</div>
{% endfor %}
</div>
</div> <!-- .event-block -->
{% endfor %}