{% macro renderAttributes(attributes) %}
{% for attributeKey, attributeValue in attributes -%}
{{ attributeKey }}="{{ attributeValue }}"
{%- endfor %}
{% endmacro %}
{% if menu is not empty %}
{% import _self as macros %}
<ul {{ macros.renderAttributes(menu.attributes) }}>
{% for item in menu.items %}
{% set hasRight = item.right is empty or is_granted(item.right) == item.hasRight %}
{% if hasRight %}
{% set attributes = item.attributes %}
{% if attributes.class is defined %}
{% set class = attributes.class|split(' ')|merge(['nav-item']) %}
{% else %}
{% set class = ['nav-item'] %}
{% endif %}
{% if item.slug is not empty %}
{% set class = class|merge(['link-'~item.slug]) %}
{% endif %}
{% if loop.first %}
{% set class = class|merge(['first']) %}
{% endif %}
{% if loop.last %}
{% set class = class|merge(['last']) %}
{% endif %}
{% set uri = '' %}
{% if item.url is not empty %}
{% set uri = item.url %}
{% elseif item.path is not empty %}
{% set parameters = item.parameterValue + ['_locale', item.locale] %}
{% set uri = path(item.path, item.parameterValue) %}
{% endif %}
{% if uri is not null %}
{% set attributes = attributes|merge({class:class|join(' ')}) %}
<li {{ macros.renderAttributes(attributes) }}>
<a class="nav-link" href="{{ uri }}">{% if item.items is not empty %}<span>+</span>{% endif %}{{ item.title }}</a>
{% if attributes['data-image'] is defined %}
<img src="{{ asset(attributes['data-image']) }}" alt="{{ item.title }}" />
{% endif %}
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
{#{% block javascripts %}#}
{# {{ parent() }}#}
{# <script type="application/javascript" src="{{ asset('assets/app/menu.js') }}"></script>#}
{#{% endblock %}#}