monster_menus-9.0.x-dev/templates/mm-archive.html.twig

templates/mm-archive.html.twig
{#
/**
 * @file
 * Theme override to display a menu.
 *
 * Available variables:
 * - title: The main title.
 * - header:
 * - items: A nested list of menu items. Each menu item contains:
 *   - attributes: HTML attributes for the menu item.
 *   - title: The menu link title.
 *   - footer: The links underneath the menu.
 *   - below: The menu item child items.
 *   - url: The menu link url, instance of \Drupal\Core\Url
 *   - localized_options: Menu link localized options.
 */
#}

{{ attach_library('monster_menus/select_menu') }}
<div class="archive-links">
  {% if title %}
    <label class="archive-link">{{ title }}</label>
  {% endif %}

  {% if items %}
    {#
      We call a macro which calls itself to render the full tree.
      @see http://twig.sensiolabs.org/doc/tags/macro.html
    #}
    {% import _self as menus %}
    {{ menus.menu_links(items, attributes) }}
  {% endif %}

  {% if footer %}
    {% for item in footer %}
      <span class="archive-link">{{ link(item.title, item.url) }}</span>
    {% endfor %}
  {% endif %}
</div>

{% macro menu_links(items, attributes) %}
  {% import _self as menus %}
  {% if items %}
    <ul{{ attributes }}>
    {% for item in items %}
      {% if item.below %}
        <li>{{ item.title }}</li>
        {{ menus.menu_links(item.below, item.attributes) }}
      {% else %}
        <li>{{ link(item.title, item.url) }}</li>
      {% endif %}
    {% endfor %}
    </ul>
  {% endif %}
{% endmacro %}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc