{% extends 'knp_menu.html.twig' %}
{% block list %}
{% import "knp_menu.html.twig" as macros %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{{ block('children') }}
{% endif %}
{% endblock %}
{% block item %}
{% import "knp_menu.html.twig" as macros %}
{% if item.displayed %}
{# building the class of the item #}
{%- set classes = item.attribute('class') is not empty ? [item.attribute('class')] : [] %}
{%- set attributes = item.attributes %}
{%- if classes is not empty %}
{%- set attributes = attributes|merge({'class': classes|join(' ')}) %}
{%- endif %}
{%- set classes = item.linkAttributes('class') is not empty ? item.linkAttributes('class') : [] %}
{%- if matcher.isCurrent(item) %}
{%- set classes = classes|merge(['active']) %}
{%- endif %}
{%- set linkAttributes = item.linkAttributes %}
{%- if classes is not empty %}
{%- set linkAttributes = linkAttributes|merge({'class': classes|join(' ')}) %}
{%- endif %}
{# displaying the item #}