-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5795d54
commit 5b8f119
Showing
1 changed file
with
39 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,43 @@ | ||
<?php | ||
{% extends "@Contao/content_element/gallery.html.twig" %} | ||
|
||
use Contao\CoreBundle\DataContainer\PaletteManipulator; | ||
use Contao\DataContainer; | ||
{% set imageHeight = '0' %} | ||
|
||
$GLOBALS['TL_DCA']['tl_content']['fields']['use_flex_gallery_image'] = [ | ||
'label' => &$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 %} | ||
<div class="flex-images fleximages_{{ data.id }}"> | ||
{{ parent() }} | ||
</div> | ||
{% 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 = '<script> new flexImages({ selector: ".fleximages_' ~ data.id ~ '", rowHeight: "' ~ imageHeight ~ '" }); </script>' %} | ||
{{ assembledScript|raw }} | ||
{% endblock %} | ||
|
||
{% block list %} | ||
{% for item in list.items %} | ||
{%- block list_item %} | ||
{{ parent() }} | ||
{% endblock -%} | ||
{% endfor %} | ||
{% endblock %} |