src/CoreBundle/Resources/views/Menu/left_menu.html.twig
{% extends '@KnpMenu/menu.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 %}
{# based in vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views/knp_menu.html.twig #}
{% block label %}
{% if item.extras.icon is not null %}
<i class="fa fa-{{ item.extras.icon }}"></i>
{% else %}
<i class="far fa-circle"></i>
{% endif %}
{{ parent() }}
{% set childrenCount = item.children|length %}
{% endblock %}
{% block linkElement %}
{% import _self as knp_menu %}
{% set link = item.uri %}
{% if item.hasChildren %}
{% set link = '#' %}
{% endif %}
<a href="{{ link }}"{{ knp_menu.attributes(item.linkAttributes) }}>
{{ block('label') }}
</a>
{% endblock %}