{# 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. #} {% extends 'base.html.twig' %} {%- block actions -%} {% include '@SonataAdmin/CRUD/action_buttons.html.twig' %} {%- endblock -%} {%- block tab_menu -%} {{ knp_menu_render(admin.sidemenu(action), { 'currentClass': 'active', 'template': get_global_template('tab_menu_template') }, 'twig') }} {%- endblock -%} {% block title %} {{ admin.isChild and admin.parent.subject ? 'title_edit'|trans({'%name%': admin.parent.toString(admin.parent.subject)|u.truncate(15, '...') }, 'SonataAdminBundle') : '' }} {% endblock %} {% block navbar_title %} {{ admin.isChild and admin.parent.subject ? 'title_edit'|trans({'%name%': admin.parent.toString(admin.parent.subject)|u.truncate(100, '...') }, 'SonataAdminBundle') : '' }} {% endblock %} {# Define the variable out of the block to prevent error if someone is overriding the list_table and not the list_footer #} {% set datagrid_has_results = admin.datagrid.results|length > 0 %} {% block list_table %}
{% set batchactions = admin.batchactions %} {% if admin.hasRoute('batch') and batchactions|length %}
{% endif %} {# Add a margin if no pager to prevent dropdown cropping on window #}
{{ sonata_block_render_event('sonata.admin.list.table.top', { 'admin': admin }) }} {% block list_header %}{% endblock %} {% if datagrid_has_results %} {% block table %} {% block table_header %} {% for field_description in admin.list.getElements() %} {% if admin.hasRoute('batch') and field_description.name == constant('Sonata\\AdminBundle\\Datagrid\\ListMapper::NAME_BATCH') and batchactions|length > 0 %} {% elseif field_description.name == constant('Sonata\\AdminBundle\\Datagrid\\ListMapper::NAME_SELECT') %} {% elseif field_description.name == constant('Sonata\\AdminBundle\\Datagrid\\ListMapper::NAME_ACTIONS') and app.request.isXmlHttpRequest %} {# NEXT_MAJOR: Remove this case in version 5 and recommend using the option `ajax_hidden` instead. #} {# Action buttons disabled in ajax view! #} {% elseif field_description.getOption('ajax_hidden') == true and app.request.isXmlHttpRequest %} {# Disable fields with 'ajax_hidden' option set to true #} {% else %} {% set sortable = false %} {% if field_description.option('sortable', false) %} {% set sortable = true %} {% set sort_parameters = admin.datagrid.sortparameters(field_description) %} {% set current = admin.datagrid.values[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_BY')] is defined and (admin.datagrid.values[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_BY')] == field_description or admin.datagrid.values[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_BY')].name == sort_parameters.filter[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_BY')]) %} {% set sort_active_class = current ? 'sonata-ba-list-field-order-active' : '' %} {% set sort_by = current ? admin.datagrid.values[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_ORDER')] : field_description.option(constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_ORDER'), sort_parameters.filter[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::SORT_ORDER')]) %} {% endif %} {% apply spaceless %} {% endapply %} {% endif %} {% endfor %} {% endblock %} {% block table_body %} {% include get_admin_template('outer_list_rows_' ~ admin.getListMode(), admin.code) %} {% endblock %} {% block table_footer %} {% endblock %}
{% if sortable %} {% endif %} {% if field_description.getOption('label_icon') %} {{ field_description.getOption('label_icon')|parse_icon }} {% endif %} {% if field_description.label is not same as(false) %} {% if field_description.translationDomain is same as(false) %} {{ field_description.label }} {% else %} {{ field_description.label|trans({}, field_description.translationDomain) }} {% endif %} {% endif %} {% if sortable %}{% endif %}
{% endblock %} {% else %} {% block no_result_content %}
{{ 'no_result'|trans({}, 'SonataAdminBundle') }}
{% endblock %} {% endif %} {{ sonata_block_render_event('sonata.admin.list.table.bottom', { 'admin': admin }) }}
{% block list_footer %} {% if datagrid_has_results %} {% endif %} {% endblock %}
{% if admin.hasRoute('batch') and batchactions|length %}
{% endif %}
{% endblock %} {% block list_filters_actions %} {% set displayableFilters = admin.datagrid.filters|filter(filter => filter.option('show_filter') is not same as (false)) %} {%- if displayableFilters|length %} {% endif -%} {% endblock %} {% block list_filters %} {% if admin.datagrid.filters %} {% form_theme form get_admin_template('filter', admin.code) %}
{{ form_errors(form) }}
{% set withAdvancedFilter = false %} {% for filter in admin.datagrid.filters %} {% set filterDisplayed = filter.isActive() or filter.option('show_filter') is same as (true) %} {% set filterCanBeDisplayed = filter.option('show_filter') is not same as(false) %}
{% if filter.label is not same as(false) %} {% endif %} {% set attr = form[filter.formName].children['type'].vars.attr|default({}) %}
{{ form_widget(form[filter.formName].children['type'], {'attr': attr}) }}
{{ form_widget(form[filter.formName].children['value']) }}
{% if filterCanBeDisplayed %} {% endif %}
{% if filter.option('advanced_filter') %} {% set withAdvancedFilter = true %} {% endif %} {% endfor %}
{% set foo = form[constant('Sonata\\AdminBundle\\Datagrid\\DatagridInterface::PAGE')].setRendered() %} {{ form_rest(form) }}
{{ 'link_reset_filter'|trans({}, 'SonataAdminBundle') }}
{% if withAdvancedFilter %} {% endif %}
{% for paramKey, paramValue in admin.persistentParameters %} {% endfor %}
{% endif %} {% endblock %}