{% extends 'knp_menu_base.html.twig' %} {% macro attributes(attributes) %} {% for name, value in attributes %} {%- if value is not none and value is not same as (false) -%} {{- ' %s="%s"'|format(name, value is same as (true) ? name|e : value|e)|raw -}} {%- endif -%} {%- endfor -%} {% endmacro %} {% from _self import attributes as attributes %} {% block compressed_root %} {% apply spaceless %} {{ block('root') }} {% endapply %} {% endblock %} {% block root %} {% set options = options|merge({'currentDepth': 0}) %} {% if options.style is defined and options.currentClass is defined and options.currentClass == 'current' %} {% set options = options|merge({'currentClass': 'active'}) %} {% set options = options|merge({'ancestorClass': 'active'}) %} {% endif %} {% set listAttributes = item.childrenAttributes %} {{ block('list') -}} {% endblock %} {% block list %} {% if item.hasChildren and options.depth is not same as (0) and item.displayChildren %} {# Il y a des items #} {% set listAttributes = listAttributes|merge({'class': listAttributes.class|default('')|trim}) %} {% set listClass = '' %} {# Type de menu #} {% if options.style is defined %} {% if options.style == 'horizontal' %} {% set listClass = 'navbar-nav' %} {% elseif options.style == 'horizontal-center' %} {% set listClass = 'navbar-nav justify-content-center' %} {% elseif options.style == 'horizontal-right' %} {% set listClass = 'navbar-nav ms-auto' %} {% elseif options.style == 'vertical' %} {% set listClass = 'flex-column' %} {% elseif options.style == 'vertical-pills' %} {% set listClass = 'flex-column nav-pills' %} {% elseif options.style == 'tabs' %} {% set listClass = 'nav-tabs' %} {% elseif options.style == 'pills' %} {% set listClass = 'nav-pills' %} {% elseif options.style == 'pills-fill' %} {% set listClass = 'nav-pills nav-fill' %} {% elseif options.style == 'pills-justify' %} {% set listClass = 'nav-pills nav-justified' %} {% endif %} {% endif %} {% set listClass = listClass ~ ' nav' %} {% set listAttributes = listAttributes|merge({'class': (listAttributes.class|default('') ~ ' ' ~ listClass)|trim}) %}