aerodash-1.0.2/templates/toolbar/menu--toolbar.html.twig

templates/toolbar/menu--toolbar.html.twig
{#
/**
  * @file
  * Default theme implementation to display a toolbar 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.
  *
  * @ingroup themeable
  */
#}
{% import _self as menus %}

{#
  We call a macro which calls itself to render the full tree.
  @see https://twig.symfony.com/doc/3.x/tags/macro.html
#}
{{ menus.menu_links(items, attributes, 0) }}

{% macro menu_links(items, attributes, menu_level, parent, menu_name, icon_default, icon_path, toolbar_variant) %}
  {% import _self as menus %}
  {% if items %}
    {% if menu_level == 0 %}
      <ul{{ attributes.addClass('toolbar-menu', 'metismenu', 'clearfix') }}>
    {% else %}
    <ul class="toolbar-menu">
      {% endif %}
      {% for item in items %}
        {%
          set classes = [
            'menu-item',
            item.is_expanded ? 'menu-item--expanded',
            item.is_collapsed ? 'menu-item--collapsed',
            item.in_active_trail ? 'menu-item--active-trail',
            item.gin_id ? 'menu-item__' ~ item.gin_id
          ]
        %}
  
        {# {% if menu_level == 0 and item.gin_id == 'help-main' %}
          <li class="menu-item menu-item__spacer menu-item--no-link"></li>
        {% endif %} #}
  
        {# Add Menu Titles #}
        {% if menu_level == 1 and loop.index == 1 %}
          <li class="menu-item-title">
            <h2 class="toolbar-menu__title">
              <a href="{{ parent.url }}">{{ parent.title }}</a>
            </h2>
          </li>
          {% if toolbar_variant == 'vertical' %}
            <li class="menu-item">
              <a href="{{ parent.url }}" class="toolbar-icon">{{ 'Overview'|t }}</a>
            </li>
          {% endif %}
        {% elseif menu_level > 1 and loop.index == 1 %}
          <li class="menu-item-title">
            <h3 class="toolbar-menu__sub-title">
              <a href="{{ parent.url }}">{{ parent.title }}</a>
            </h3>
          </li>
          {% if toolbar_variant == 'vertical' %}
            <li class="menu-item">
              <a href="{{ parent.url }}" class="toolbar-icon">{{ 'Overview'|t }}</a>
            </li>
          {% endif %}
        {% endif %}
  
        <li{{ item.attributes.addClass(classes) }}>
          {% if item.gin_id == 'admin_toolbar_tools-help' and icon_default == false and icon_path != '' %}
            <a href="{{ path('<front>') }}" class="toolbar-logo" data-drupal-link-system-path="<front>">
              <img src="{{ file_url(icon_path) }}" class="toolbar-icon-home" alt="{{ 'Home'|t }}" />
            </a>
          {% elseif item.gin_id == 'admin_toolbar_tools-help' %}
            {{ link('Drupal', item.url, {'class': ['toolbar-icon-default']}) }}
          {% else %}
            {{ link(item.title, item.url, {'class': [item.in_active_trail ? 'is-active']}) }}
          {% endif %}
          {% if item.below %}
            {{ menus.menu_links(item.below, attributes, menu_level + 1, item, menu_name, icon_default, icon_path, toolbar_variant) }}
          {% endif %}
        </li>
      {% endfor %}
      </ul>
  {% endif %}
{% endmacro %}

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

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