54 lines
2.3 KiB
Twig
54 lines
2.3 KiB
Twig
{% 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 %}
|
|
{% set translation_domain = item.extra('label_catalogue', 'messages') %}
|
|
{% if item.extra('on_top') is defined and not item.extra('on_top') %}
|
|
{% set icon = item.extra('icon')|default(item.level > 1 ? '<i class="fa fa-angle-double-right" aria-hidden="true"></i>' : '') %}
|
|
{% else %}
|
|
{% set icon = item.extra('icon') %}
|
|
{% endif %}
|
|
{% set is_link = true %}
|
|
{{ parent() }}
|
|
{% endspaceless %}
|
|
{% endblock %}
|
|
|
|
{% block spanElement %}
|
|
{% spaceless %}
|
|
<a href="#">
|
|
{% 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') -%}
|
|
<span class="pull-right-container"><i class="fa pull-right fa-angle-left"></i></span>
|
|
{%- endif -%}
|
|
</a>
|
|
{% 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 %}
|