{# This file is part of the Sonata package. (c) Thomas Rabaix For the full copyright and license information, please view the LICENSE file that was distributed with this source code. #} {% set route = field_description.options.route.name|default(null) %} {% set action = route == 'show' ? 'VIEW' : route|upper %} {% if field_description.options.identifier is defined and route and action and admin.hasRoute(route) and admin.isGranted(action, action in ['VIEW', 'EDIT'] ? object : null) %} {%- block field %}{{ value }}{% endblock -%} {% else %} {% set isEditable = field_description.options.editable is defined and field_description.options.editable and admin.isGranted('EDIT', object) %} {% set xEditableType = field_description.type|sonata_xeditable_type %} {% if isEditable and xEditableType %} {% set url = path('sonata_admin_set_object_field_value', { 'context': 'list', 'field': field_description.name, 'objectId': admin.id(object), 'code': admin.code(object) }) %} {{ block('field') }} {% else %} {{ block('field') }} {% endif %} {% endif %}