{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{# NEXT_MAJOR: Remove this #}
{% deprecated 'The "base_list_flat_field.html.twig" template is deprecated since sonata-project/admin-bundle version 4.3 and will be removed in 5.0.' %}

<span class="sonata-ba-list-field sonata-ba-list-field-{{ field_description.type }}" objectId="{{ admin.id(object) }}">
    {% set route_name = field_description.option('route').name|default(sonata_config.getOption('default_admin_route')) %}
    {% set route_parameters = field_description.option('route').parameters|default([]) %}

    {% if
        field_description.option('identifier', false)
        and route_name
        and admin.hasAccess(route_name, object)
        and admin.hasRoute(route_name)
    %}
        <a href="{{ admin.generateObjectUrl(route_name, object, route_parameters) }}">
            {%- block field %}{{ value }}{% endblock -%}
        </a>
    {% else %}
        {{ block('field') }}
    {% endif %}
</span>
