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

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

{# TEMPLATE #}
<nav aria-label="Menu {{ tid }}">
  <ul {{ wrapper_attributes.addClass(wrapper_classes) }} >
    {% for link in links %}
      {% if not link['hide_item'] %}
        {% set title = link['title'] %}
        {% 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>
