From 076de4da6221550a47f5f57887130cf2dda9ac21 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 23 Oct 2023 14:11:56 +0200 Subject: [PATCH] Update gallery.html.twig --- .../content_element/gallery.html.twig | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/contao/templates/content_element/gallery.html.twig b/contao/templates/content_element/gallery.html.twig index d59892e..78d32c3 100644 --- a/contao/templates/content_element/gallery.html.twig +++ b/contao/templates/content_element/gallery.html.twig @@ -3,41 +3,51 @@ {% set imageHeight = '0' %} {% block figure_component %} - {% if figure.image.img.width %} - {% if figure.image.img.height %} - {% set figure_attributes = attrs() - .set('data-w', figure.image.img.width) - .set('data-h', figure.image.img.height) - %} - {% set figure_attributes = attrs(figure_attributes|default).addClass('item') %} + {% if data.use_flex_gallery_image %} + {% if figure.image.img.width %} + {% if figure.image.img.height %} + {% set figure_attributes = attrs() + .set('data-w', figure.image.img.width) + .set('data-h', figure.image.img.height) + %} + {% set figure_attributes = attrs(figure_attributes|default).addClass('item') %} + {% endif %} {% endif %} + {{ parent() }} + {% set imageHeight = figure.image.img.height %} + {{ app.session.set('imageHeight', imageHeight) }} + {% else %} + {{ parent() }} {% endif %} - {{ parent() }} - {% set imageHeight = figure.image.img.height %} - {{ app.session.set('imageHeight', imageHeight) }} {% endblock %} {% block content %} + {% if data.use_flex_gallery_image %}
{{ parent() }}
+ {% else %} + {{ parent() }} + {% endif %} {% endblock %} {% block wrapper %} {{ parent() }} - {% set maxHeight = '180' %} - {% if data.flex_gallery_image_height %} - {% set maxHeight = data.flex_gallery_image_height %} - {% endif %} {% set imageHeight = app.session.get('imageHeight') %} {% set assembledScript = '' %} - {{ assembledScript|raw }} + {% if data.use_flex_gallery_image %} + {{ assembledScript|raw }} + {% endif %} {% endblock %} {% block list %} - {% for item in list.items %} - {%- block list_item %} - {{ parent() }} - {% endblock -%} - {% endfor %} + {% if data.use_flex_gallery_image %} + {% for item in list.items %} + {%- block list_item %} + {{ parent() }} + {% endblock -%} + {% endfor %} + {% else %} + {{ parent() }} + {% endif %} {% endblock %}