{# 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 sonata_block.templates.block_base %} {% block block %}
{% if settings.title is not empty %}

{{ settings.title }}

{% endif %}
{% if root.children|length %} {% else %}

{{ 'no_categories_found'|trans({}, 'SonataClassificationBundle') }}

{% endif %}
{% endblock %} {% macro attributes(attributes) %} {% for name, value in attributes %} {%- if value is not none and value is not sameas(false) -%} {{- ' %s="%s"'|format(name, value is sameas(true) ? name|e : value|e)|raw -}} {%- endif -%} {%- endfor -%} {% endmacro %} {% block list %} {% if item.children|length %} {% endif %} {% endblock %} {% block children %} {# save current variables #} {% set currentItem = item %} {% for item in currentItem.children %} {{ block('item') }} {% endfor %} {# restore current variables #} {% set item = currentItem %} {% endblock %} {% block item %} {# building the class of the item #} {%- set classes = [] %} {%- if active and active.id == item.id %} {%- set classes = classes|merge(['active']) %} {%- endif %} {%- if loop.first %} {%- set classes = classes|merge(['first']) %} {%- endif %} {%- if loop.last %} {%- set classes = classes|merge(['last']) %} {%- endif %} {%- set attributes = [] %} {%- if classes is not empty %} {%- set attributes = attributes|merge({'class': classes|join(' ')}) %} {%- endif %} {{ block('link_category') }} {# render the list of children#} {{ block('list') }} {% endblock %} {% block link_category %}{{ block('label') }}{% endblock %} {% block label %}{{ category.name }}{% endblock %}