{% extends 'knp_menu.html.twig' %} {% block root %} {%- set listAttributes = item.childrenAttributes|merge({'class': 'sidebar-menu'}) %} {%- set request = item.extra('request') ?: app.request %} {{ block('list') -}} {% endblock %} {% block item %} {%- if item.displayed %} {#- check role of the group #} {%- set display = (item.extra('roles') is empty or is_granted('ROLE_SUPER_ADMIN') ) %} {%- for role in item.extra('roles') if not display %} {%- set display = is_granted(role) %} {%- endfor %} {%- endif %} {%- if item.displayed and display|default %} {% set options = options|merge({branch_class: 'treeview', currentClass: "active"}) %} {%- do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' active')|trim) %} {%- do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' treeview-menu')|trim) %} {{ parent() }} {% endif %} {% endblock %} {% block linkElement %} {% spaceless %} {% if item.extra('on_top') is defined and not item.extra('on_top') %} {% set translation_domain = item.extra('translation_domain', 'messages') %} {% set icon = item.extra('icon')|default(item.level > 1 ? '' : '') %} {% else %} {% set icon = item.extra('icon') %} {% endif %} {% set is_link = true %} {{ parent() }} {% endspaceless %} {% endblock %} {% block spanElement %} {% spaceless %} {% set translation_domain = item.extra('label_catalogue') %} {% set icon = item.extra('icon')|default('') %} {{ icon|raw }} {{ parent() }} {%- if item.extra('keep_open') is not defined or not item.extra('keep_open') -%} {%- endif -%} {% endspaceless %} {% endblock %} {% block label %}{% if is_link is defined and is_link %}{{ icon|default|raw }}{% endif %}{% if options.allow_safe_labels and item.extra('safe_label', false) %}{{ item.label|raw }}{% else %}{{ item.label|trans({}, translation_domain|default('messages')) }}{% endif %}{% endblock %}