{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}

{% if field.value is not null and field.value.path is not null %}

    {% set id_modal = 'modal-'~field.value.id %}

    <a href="{{ sov_liip(field.value.path, 'big') }}" data-toggle="modal" data-target="#{{ id_modal }}" title="{{ field.value.legend }}">
        <img src="{{ sov_liip(field.value.path, 'index') }}" alt="{{ field.value.legend }}">
    </a>

    {% embed "@LcSov/adminlte/embed/modal.twig" %}
        {% block id %}{{ id_modal }}{% endblock %}
        {% block size %}modal-xl{% endblock %}
        {% block title %}{{ field.value.legend ? field.value.legend : 'Image' }}{% endblock %}
        {% block body %}
            <img src="{{ sov_liip(field.value.path, 'big') }}" alt="{{ field.value.legend }}" />
        {% endblock %}
        {% block footer_wrapper %}{% endblock %}
    {% endembed %}

{% else %}
    <div class="badge badge-secondary">Aucun(e)</div>
{% endif %}