{# 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 '@SonataAdmin/CRUD/base_list.html.twig' %} {% import _self as tree %} {% macro navigate_child(collection, admin, root, current_category_id, depth) %} {% import _self as tree %} {% if root and collection|length == 0 %}

{{ 'warning_no_category'|trans({}, admin.translationdomain) }}

{% endif %} {% for element in collection if element is not null %}
  • {% if element.parent or root %}{% endif %} {{ element.name }}
    {% if element.children|length %} {{ tree.navigate_child(element.children, admin, false, current_category_id, depth + 1) }} {% endif %}
  • {% endfor %} {% endmacro %} {% block list_table %} {% if datagrid.values['category']['value'] is defined %}
    {{ tree.navigate_child([root_category], admin, true, datagrid.values['category']['value'], 1) }}
    {{ parent() }}
    {% else %} {{ parent() }} {% endif %} {% endblock %}