Dynamically insert variable from HubDB into Gallery


#1

Does anyone know if it is possible to pass a value out of a HubDB table into a Gallery module. I’d like to dynamically set the caption and image in the DB an have it automatically flow through to the gallery.

i.e.

{% set queryparam = “code=” + content.widgets.module_149799251859434.body.vehiclecode %}

{% for row in hubdb_table_rows(xxxxx, queryparam) %}

{% set name =row.name %}
{% set image1 =row.image_1.url %}

{% widget_block gallery overrideable=False "Gallery" display_mode='thumbnail' sizing='resize', transition='fade', caption_position='below', auto_advance=True, description_text='', show_pagination=True, label='Gallery', loop_slides=False, num_seconds=5  %}
    {% widget_attribute "slides" is_json=True %}
         [
             {"caption": "{{name}} - Layout 1", "show_caption": true, "link_url": "", "alt_text": "{{name}} - Layout 1", "img_src": "{{image1}}", "open_in_new_tab": true}
         ]
    {% end_widget_attribute %}
{% end_widget_block %}

{% endfor %}