{% set childIndex = loop.index - 1 %}
{#{% set sectionAlias = (child is defined and child.alias is not empty)#}
{# ? child.alias#}
{# : ((section is defined and section.alias is not empty)#}
{# ? section.alias#}
{# : '') %}#}
{# {{ dump(pageAlias, sectionAlias) }}#}
{% set maxFilesValue = (child is defined and child.imageMaxFiles is not null)
? child.imageMaxFiles
: section.imageMaxFiles
%}
{% set multipleDropzone = true %}
{% set dimensions = section.dimensions ? section.dimensions : '540x540' %}
{% set options = {} %}
{% if maxFilesValue is not null %}
{% set options = { 'maxFiles': maxFilesValue, acceptedFiles: '.jpeg,.jpg,.png,.webp,.gif,.bmp,.svg' } %}
{% endif %}
{% if child is defined %}
{% if (child.canBeAddedImage is not null ? child.canBeAddedImage : section.canBeAddedImage) %}
{# Dimensions #}
{% set files = [] %}
{% set langsForImages = [] %}
{% for lang in child.langs|default %}
{% set key = lang.lang.shortTitle %}
{% set langsForImages = langsForImages|merge({(key): lang.alt}) %}
{% endfor %}
{% for image in child.images|filter(e => e.del == 0)|default([]) %}
{% if image.name|default %}
{% set files = files|merge([{
id: image.id,
name: image.name,
langs: langsForImages,
location: asset('media/page/'~pageAlias~'/'~sectionAlias~'/'~image.name)
}]) %}
{% endif %}
{% endfor %}
{{ include('admin/Common/_dropzone.html.twig', {
multipleDropzone: multipleDropzone,
name: 'image' ~ child.id,
sectionId: section.id,
childIndex: childIndex,
dimensions: dimensions,
files: files,
options: options,
}, with_context = false) }}
{% endif %}
{% else %}
{% if section.canBeAddedImage %}
{# Dimensions #}
{% set files = [] %}
{% set langsForImages = [] %}
{% for lang in child.langs|default %}
{% set key = lang.lang.shortTitle %}
{% set langsForImages = langsForImages|merge({(key): lang.alt}) %}
{% endfor %}
{% for image in section.images|filter(e => e.del == 0)|default([]) %}
{% if image.name|default %}
{% set files = files|merge([{
id: image.id,
name: image.name,
langs: langsForImages,
location: asset('media/page/'~pageAlias~'/'~sectionAlias~'/'~image.name)
}]) %}
{% endif %}
{% endfor %}
{{ include('admin/Common/_dropzone.html.twig', {
multipleDropzone: multipleDropzone,
name: 'image' ~ section.id,
sectionId: section.id,
childIndex: childIndex,
dimensions: dimensions,
files: files,
options: {
maxFiles: 2,
acceptedFiles: '.jpeg,.jpg,.png,.webp,.gif,.bmp,.svg'
}
}, with_context = false) }}
{% endif %}
{% endif %}
{% for lang in getLangs() %}
{% if category %}
{% set pageLang = child is defined ? getPageSectionSectionsLang({'section': child.id, 'lang': lang.shortTitle}) : {} %}
{% else %}
{% set pageLang = child is defined ? getPageSectionLang({'section': child.id, 'lang': lang.shortTitle}) : {} %}
{% endif %}
{% if (child is defined and child.canBeAddedShortTitle is not null ? child.canBeAddedShortTitle : section.canBeAddedShortTitle) %}
{% endif %}
{% if (child is defined and child.canBeAddedTitle is not null ? child.canBeAddedTitle : section.canBeAddedTitle) %}
{% endif %}
{% if (child is defined and child.canBeAddedTitleTwo is not null ? child.canBeAddedTitleTwo : section.canBeAddedTitleTwo) %}
{% endif %}
{% if (child is defined and child.canBeAddedText is not null ? child.canBeAddedText : section.canBeAddedText) %}
{% endif %}
{% if (child is defined and child.canBeAddedLink is not null ? child.canBeAddedLink : section.canBeAddedLink) %}