{# LIBRARIES #}
{{ attach_library('ui_patterns/menu_std.menu_std_lib') }}

{# VARIABLES #}
{% set mid = mid|default(random()) %}
{% set max_depth = max_depth|default(0) %}
{% set wrapper_attributes = wrapper_attributes|default(create_attribute())%}
{% set wrapper_classes = [
  wrapper_class ? wrapper_class : "",
  "nav-std",
  "uln",
]%}

{# TEMPLATE #}
<nav aria-label="Standard menu {{ mid }}">
  <ul {{ wrapper_attributes.addClass(wrapper_classes) }} >
    {% for link in links %}
      {% if not link['hide_item'] %}
        {% set title = link['title'] %}
        {% set icon = 'fas fa-angle-right' %}
        {% if link['image'] %}
          {% set title = link['image'] %}
          {% set icon = '<none>' %}
        {% endif %}
        {% include "@organisms/tm-menu/menu-std/menu-std-item.twig" with {
          "lid": link['lid'],
          "title": title,
          "url": link['url'],
          "attr": link['attributes'],
          "class": link['class'],
          "sub_links": link['sub_links'],
          "in_active_trail": link['in_active_trail'],
          "active": link['active'],
          "depth": 0,
          "max_depth": max_depth,
          "icon": icon,
        } only %}
      {% endif %}
    {% endfor %}
  </ul>
</nav>
