{% extends 'knp_menu.html.twig' %} {% block label %} {% if item.labelAttribute('icon') %}{% endif %} {% if not item.labelAttribute('iconOnly') %} {% if options.allow_safe_labels and item.getExtra('safe_label', false) %}{{ item.label|trans|raw }}{% else %}{{ item.label|trans }}{% endif %} {% endif %} {% if item.labelAttribute('data-image') %}{% endif %} {% import _self as selfMacros %} {% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %} {{ selfMacros.badges(item) }} {% else %} {{ selfMacros.badges(item) }} {% endif %} {% endblock %} {% macro badges(item) %} {% import _self as selfMacros %} {% if item.getExtra('badge') is not null %} {{ selfMacros.badge(item.getExtra('badge')) }} {% elseif item.getExtra('badges') is not null %} {% for badge in item.getExtra('badges') %} {{ selfMacros.badge(badge) }} {% endfor %} {% endif %} {% endmacro %} {% macro badge(badge) %} {{ badge.value }} {% endmacro %} {% block list %} {% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %} {% import "knp_menu.html.twig" as macros %} {% if matcher.isAncestor(item) %} {%- set listAttributes = listAttributes|merge({class: (listAttributes.class|default('') ~ ' in')|trim}) -%} {% endif %} {% if not item.isRoot %} {%- set listAttributes = listAttributes|merge({class: (listAttributes.class|default('') ~ ' treeview-menu')|trim}) -%} {% endif %}