{% extends 'knp_menu.html.twig' %}
{% block root %}
{%- set listAttributes = item.childrenAttributes|merge({'class': 'sidebar-menu', 'data-widget': 'tree'}) %}
{%- 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) %}
{% if item.extra('roles') is not empty and item.extra('roles')|length %}
{% for role in item.extra('roles') %}
{% if not display %}
{% set display = role in app.user.roles %}
{% endif %}
{% endfor %}
{% endif %}
{#- start of new block #}
{% if display|default %}
{% set options = options|merge({branch_class: 'treeview', currentClass: "active", ancestorClass: "active"}) %}
{% do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' active')|trim) %}
{% do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' treeview-menu')|trim) %}
{{ parent() }}
{% endif %}
{#- end of new block #}
{% endif %}
{% endblock %}
{% block linkElement %}
{% 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 %}
{% import "knp_menu.html.twig" as macros %}
<a href="{{ item.uri }}"{{ macros.attributes(item.linkAttributes) }}>
{% if item.attribute('icon') is not empty %}
{{ item.attribute('icon')|parse_icon }}
{% endif %}
{{ block('label') }}
</a>
{% endblock %}
{% block spanElement %}
<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>
{% 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 %}
{% if item.extras['routes'] is defined %}
{% if item.extras['routes'][0]['route'] == 'admin_app_programme_suppresion_demande_list' %}
{% set countDemandeSupp = dashboard_countDemandesSuppression() %}
{% if countDemandeSupp > 0 %}
<div><span class="pastille-notif">{{ countDemandeSupp }}</span></div>
{% endif %}
{% endif %}
{% endif %}
{% endblock %}