From 5b8f11968bf50aca6e52fcf672f168e9c56c536b Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 23 Oct 2023 14:00:47 +0200 Subject: [PATCH] Update gallery.html.twig --- .../content_element/gallery.html.twig | 56 +++++++++++++------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/contao/templates/content_element/gallery.html.twig b/contao/templates/content_element/gallery.html.twig index e90ba7b..d59892e 100644 --- a/contao/templates/content_element/gallery.html.twig +++ b/contao/templates/content_element/gallery.html.twig @@ -1,21 +1,43 @@ - &$GLOBALS['TL_LANG']['tl_content']['use_flex_gallery_image'], - 'inputType' => 'checkbox', - 'search' => true, - 'eval' => array('tl_class' => 'w50'), - 'sql' => array('type' => 'boolean', 'default' => false) -]; +{% 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') %} + {% endif %} + {% endif %} + {{ parent() }} + {% set imageHeight = figure.image.img.height %} + {{ app.session.set('imageHeight', imageHeight) }} +{% endblock %} -$GLOBALS['TL_DCA']['tl_content']['fields']['perRow']['eval']['tl_class'] = 'w25 hidden'; -$GLOBALS['TL_DCA']['tl_content']['fields']['perPage']['eval']['tl_class'] = 'w25'; -$GLOBALS['TL_DCA']['tl_content']['fields']['numberOfItems']['eval']['tl_class'] = 'w25'; +{% block content %} +
+ {{ parent() }} +
+{% endblock %} -PaletteManipulator::create() - ->addField('use_flex_gallery_image', 'image_legend', PaletteManipulator::POSITION_APPEND) - ->applyToPalette('gallery', 'tl_content') -; +{% 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 }} +{% endblock %} + +{% block list %} + {% for item in list.items %} + {%- block list_item %} + {{ parent() }} + {% endblock -%} + {% endfor %} +{% endblock %}