render an entire module after export_to_template_context=True

SOLVE
Highlighted
Occasional Contributor

I want to export to template environment as a way to queue up a module without it being displayed, and then only render the module if there is content to display. Any way to do this? is export_to_template_context the wrong idea?

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Occasional Contributor
I answered my own question

I needed to call the module again, in this case it was a {% gallery %}

I wrote an if statement to render the gallery ONLY if there was a slide...what I found was a parameter called "slides", so writing:

{% if widget_data.gallery.slides %}
{{ widget.gallery }}
{% endif %}

This worked great, even though the documentation largely spoke of ".value" as the parameter used to check if a module had value. For some reason .value would not work at all. Also, "slides" is not really spoken of at all in the hubl documentation so it was a pain to figure out.
Reply
0 Upvotes
1 Reply 1
Occasional Contributor
I answered my own question

I needed to call the module again, in this case it was a {% gallery %}

I wrote an if statement to render the gallery ONLY if there was a slide...what I found was a parameter called "slides", so writing:

{% if widget_data.gallery.slides %}
{{ widget.gallery }}
{% endif %}

This worked great, even though the documentation largely spoke of ".value" as the parameter used to check if a module had value. For some reason .value would not work at all. Also, "slides" is not really spoken of at all in the hubl documentation so it was a pain to figure out.
Reply
0 Upvotes