1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- {#
- 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.
- #}
- <td class="sonata-ba-list-field sonata-ba-list-field-{{ field_description.type }}" objectId="{{ admin.id(object) }}"{% if field_description.options.row_align is defined %} style="text-align:{{ field_description.options.row_align }}"{% endif %}>
- {% 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)
- %}
- <a class="sonata-link-identifier" href="{{ admin.generateObjectUrl(route, object, field_description.options.route.parameters) }}">
- {%- block field %}
- {% spaceless %}
- {% if field_description.options.collapse is defined %}
- {% set collapse = field_description.options.collapse %}
- <div class="sonata-readmore"
- data-readmore-height="{{ collapse.height|default(40) }}"
- data-readmore-more="{{ collapse.more|default('read_more')|trans({}, 'SonataAdminBundle') }}"
- data-readmore-less="{{ collapse.less|default('read_less')|trans({}, 'SonataAdminBundle') }}">{{ value }}</div>
- {% else %}
- {{ value }}
- {% endif %}
- {% endspaceless %}
- {% endblock -%}
- </a>
- {% 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',
- admin.getPersistentParameters|default([])|merge({
- 'context': 'list',
- 'field': field_description.name,
- 'objectId': admin.id(object),
- 'code': admin.code(object)
- })
- ) %}
- <span {% block field_span_attributes %}class="x-editable" data-type="{{ xEditableType }}" data-value="{{ field_description.type == 'date' and value is not empty ? value.format('Y-m-d') : value }}" data-title="{{ field_description.label|trans({}, field_description.translationDomain) }}" data-pk="{{ admin.id(object) }}" data-url="{{ url }}" {% endblock %}>
- {{ block('field') }}
- </span>
- {% else %}
- {{ block('field') }}
- {% endif %}
- {% endif %}
- </td>
|