{# 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. #} {# This template is not used at all, it is just a template that you can use to create your own custom tree view. #} {% extends '@SonataAdmin/CRUD/base_list.html.twig' %} {% import _self as tree %} {% macro navigate_child(collection, admin, root, depth) %} {% import _self as tree %} {% for element in collection %}
  • {% if element.parent or root %}{% endif %} {% if admin.hasRoute('edit') and admin.hasAccess('edit') %} {{ element.name }} {% elseif admin.hasRoute('show') and admin.hasAccess('show') %} {{ element.name }} {% else %} {{ element.name }} {% endif %} {{ element.description }} {#edit #} {% if element.enabled %} {{ 'active'|trans({}, admin.translationDomain) }}{% endif %} {% if not element.enabled %} {{ 'disabled'|trans({}, admin.translationDomain) }}{% endif %}
    {% if element.children|length %} {{ tree.navigate_child(element.children, admin, false, depth + 1) }} {% endif %}
  • {% endfor %} {% endmacro %} {% block tab_menu %} {% include '@SonataClassification/CategoryAdmin/list_tab_menu.html.twig' with { 'mode': 'tree', 'action': action, 'admin': admin, } only %} {% endblock %} {% block list_table %}

    {{ 'tree_catalog_title'|trans({}, admin.translationdomain) }} {% if not app.request.query.get('hide_context') and current_context is not empty %}
    {% endif %}

    {% if current_categories is empty %} {{ tree.navigate_child([], admin, true, 0) }} {% else %} {{ tree.navigate_child(current_categories, admin, true, 0) }} {% endif %}
    {% endblock %}