CMS Development

russelltnails
Participante

render an entire module after export_to_template_context=True

resolver

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?

0 Avaliação positiva
1 Solução aceita
russelltnails
Solução
Participante

render an entire module after export_to_template_context=True

resolver
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.

Exibir solução no post original

0 Avaliação positiva
1 Resposta 1
russelltnails
Solução
Participante

render an entire module after export_to_template_context=True

resolver
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.
0 Avaliação positiva