{# 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 textRightClass = '' %} {% set textCenterClass = '' %} {% if field_description.type == "number" %} {% set textRightClass = 'text-right' %} {% elseif field_description.type == "currency" %} {% set textRightClass = 'text-right' %} {% elseif field_description.type == "actions" %} {% set textRightClass = 'text-right' %} {%endif %} {% if textCenter is defined and textCenter %} {% set textRightClass = '' %} {% set textCenterClass = 'text-center' %} {%endif %} {% set prefixName = "" %} {% set groupIdGetterName = 'get' ~ prefixName ~ 'GroupId' %} {% set callbackQueryObjectPrefix = admin.getCallbackQueryObjectPrefix() %} {% if callbackQueryObjectPrefix is not null %} {% set prefixName = callbackQueryObjectPrefix[:1]|upper ~ callbackQueryObjectPrefix[1:] %} {% set groupIdGetterName = 'get' ~ prefixName ~ 'GroupId' %} {% endif %} 1 %} rowspan="{{ rowspan }}"{% endif %} {% if colspan is defined and colspan > 1 %} colspan="{{ colspan }}" {% endif %} class="sonata-ba-list-field {% block fieldType %}sonata-ba-list-field-{{ field_description.type }}{% endblock %} {{ textRightClass }} {{ textCenterClass }} {{ class is defined ? class : '' }}" objectId="{{ admin.id(object) }}" data-group-id="{{ attribute(object, groupIdGetterName) is defined ? attribute(object, groupIdGetterName) : '' }}" data-name="{{ field_description.name is defined ? field_description.name : '' }}" data-label="{{ field_description.label is defined ? admin.trans(field_description.label, {}, field_description.translationDomain) : '' }}" > {% 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 %}