templates/nodes/gallery.html.twig line 1

Open in your IDE?
  1. {% set list = load_nodes('image', {parent:module.id}).list %}
  2. {% set thmb = thmb|default(module.vars.thumb) %}
  3. <div class="node-gallery">
  4. {% set urls = [] %}
  5. <div class="{{ thmb == 'node_gallery_outbound' ? 'gallery-fullwidth' : 'image-list' }}">
  6. {% set rows = list|design_rows %}
  7. {% set num = 0 %}
  8. {% for row in rows %}
  9. {% for index, item in row %}
  10. {% set url = item.vars.url %}
  11. <a href="{% if item.vars.url %}
  12. {%- if is_video_url(url) -%}
  13. {%- set url= url -%}
  14. {%- endif -%}
  15. {{- url -}}
  16. {%- set urls = urls|merge({(index) :
  17. {
  18. src: url,
  19. type: 'video',
  20. thumb: item.vars.photo.path|imagine_filter_cache(thmb),
  21. caption: item.vars.title,
  22. sources: [url]
  23. }
  24. }) -%}
  25. {%-else-%}
  26. {{- item.vars.photo.path|imagine_filter_cache('full') -}}
  27. {%- set urls = urls|merge({(index) :
  28. {
  29. src: asset(item.vars.photo.path),
  30. thumb: item.vars.photo.path|imagine_filter_cache(thmb),
  31. title: item.vars.title,
  32. sources: [asset(item.vars.photo.path)]
  33. }
  34. }) -%}
  35. {%- endif -%}" {% if module.vars.download %} download {% else %} @click.stop.prevent="showGal({{ module.id }}, {{ index }})"{% endif %} title="{{ item.vars.title }}">
  36. {% if (thmb == 'node_gallery_outbound') %}
  37. <img src="{{ item.vars.photo.path }}" />
  38. {% else %}
  39. <img src="{{ item.vars.photo.path }}" class="gallery-square" />
  40. {% endif %}
  41. </a>
  42. {% endfor %}
  43. {% endfor %}
  44. </div>
  45. <div class="clear-fix"></div>
  46. {% if not module.vars.download %}
  47. <div v-if="galEnabled({{ module.id }})">
  48. <teleport to="body">
  49. <light-box :start-at="galStart" :show-caption="true" :media="{{ urls|json_encode|e('html_attr') }}" @onClosed="hideGal({{ module.id }})"></light-box>
  50. </teleport>
  51. </div>
  52. {% endif %}