{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set images = field.formattedValue %}
{% if images is not iterable %}
    {% set images = [images] %}
{% endif %}

{% for image in images %}
    {% if image is not empty %}
        {% set html_id = 'ea-lightbox-' ~ field.uniqueId ~ '-' ~ loop.index %}
        <a href="#" onclick="return false;" class="ea-lightbox-thumbnail" data-ea-lightbox-content-selector="#{{ html_id }}">
            <img src="{{ entity.instance|public_url }}" class="img-fluid" alt="{{ entity.instance.name ?? '' }}">
        </a>

        <div id="{{ html_id }}" class="ea-lightbox">
            <img src="{{ entity.instance|public_url }}" alt="{{ entity.instance.name ?? '' }}">
        </div>
    {% endif %}
{% endfor %}
