{% if item.display %}
  {% set hasChildren = item.children is not empty %}
  {% set class = item.attributes['class'] is defined ? item.attributes['class'] : ''  %}
  {% set attributes = item.attributes|filter((v, k) => k != 'class')|map((v, k) => k ~ '=' ~ v) %}
  <li class="nav-item {{ hasChildren ? 'dropdown' : '' }}">
    {% if item.uri %}

      <a
        class="nav-link {{ class }}{% if item.isObfuscated %} obfuscated-link{% endif %}"
        href="{% if item.isObfuscated %}#{% else %}{{ item.uri }}{% endif %}"
        {% if item.isObfuscated %}data-href="{{ item.uri }}"{% endif %}
        {% if item.isTargetBlank %}target="_blank"{% endif %}
        {{ attributes|join(' ') }}
      >
        {{ item.label }}
      </a>
    {% elseif hasChildren %}
      <span class="nav-link dropdown-toggle {{ class }}" {{ attributes|join(' ') }}>{{ item.label }}</span>
      <ul class="dropdown-menu">
        {% for child in item.children %}
          {% include '@AutoAdminMenu/_partials/menu_item.html.twig' with {'item': child} only %}
        {% endfor %}
      </ul>
    {% else %}
      <span class="nav-text {{ class }}" {{ attributes|join(' ') }}>{{ item.label }}</span>
    {% endif %}
  </li>
{% endif %}
