{#
/**
 * @file
 * menu-ac-item
 *
 * See menu-ac-item.wingsuit.yaml for documentation.
 */
#}
{% set in_active_trail = in_active_trail|default(false) %}
{% set active = active|default(false) %}
{% set max_depth = max_depth|default(0) %}
{% set depth = depth|default(0) %}
{% set icon = icon|default("fas fa-angle-right") %}
{% if icon == '<none>' %}
  {% set icon = false %}
{% endif %}

{# TEMPLATE #}
{% if max_depth > depth %}
  {% if sub_links is not empty %}
    <li class="parent depth-{{ depth }} lin">
      {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
        "text": title,
        "url": url,
        "icon_left": icon,
        "class": (active ? 'active ') ~ (in_active_trail ? 'active-trail'),
      } only %}
      <ul class="uln" id="mc-{{ lid }}">
        {% for s_link in sub_links %}
          {% include "@organisms/tm-menu/menu-std-item/menu-std-item.twig" with {
            "lid": s_link['lid'],
            "title": s_link['title'],
            "url": s_link['url'],
            "sub_links": s_link['sub_links'],
            "in_active_trail": s_link['in_active_trail'],
            "active": s_link['active'],
            "depth": depth + 1,
            "max_depth": max_depth,
          } only %}
        {% endfor %}
      </ul>
    </li>
  {% else %}
    {% if title != '<none>'%}
      <li class="depth-{{ depth }} lin">
        {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
          "text": title,
          "url": url,
          "icon_left": icon,
          "class": (active ? 'active ') ~ (in_active_trail ? 'active-trail'),
        } only %}
      </li>
    {% endif %}
  {% endif %}
{% else %}
  {% if title != '<none>'%}
    <li class="depth-{{ depth }} lin">
      {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
        "text": title,
        "url": url,
        "icon_left": icon,
        "class": (active ? 'active ') ~ (in_active_trail ? 'active-trail'),
      } only %}
    </li>
  {% endif %}
{% endif %}
