Menu

The Menu is a starting component from which other menus can be built.

class=goiz-menu
Markup Details
                            {#
/**
 * @file
 * Theme override to display a menu.
 *
 * Available variables:
 * - menu_name: The machine name of the menu.
 * - items: A nested list of menu items. Each menu item contains:
 *   - attributes: HTML attributes for the menu item.
 *   - below: The menu item child items.
 *   - title: The menu link title.
 *   - url: The menu link url, instance of \Drupal\Core\Url
 *   - localized_options: Menu link localized options.
 *   - is_expanded: TRUE if the link has visible children within the current
 *     menu tree.
 *   - is_collapsed: TRUE if the link has children within the current menu tree
 *     that are not currently visible.
 *   - in_active_trail: TRUE if the link is in the active trail.
 */
#}
{% import _self as menus %}
{# Preserve the Drupal attributes if they're available. #}
{%
  set attributes = attributes ? attributes.addClass('goiz-menu') : ' class=goiz-menu'
%}
{#
  We call a macro which calls itself to render the full tree.
  @see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ attach_library('goizueta_theme/menu') }}

{{ menus.menu_links(items, attributes) }}

{% block menu %}
  {% macro menu_links(items, attributes) %}
    {% if items %}
      <ul{{ attributes }} role="menu">
      {% for item in items %}
        <li class="goiz-menu__item">
          <a class="goiz-menu__item--link" href="{{ item.url }}">
            {{ item.title }}
          </a>
        </li>
      {% endfor %}
      </ul>
    {% endif %}
  {% endmacro %}
{% endblock %}