cheeseburger-menu.html.twig in Cheeseburger Menu 8.4
{% import _self as cheesebuger %}
{% if show_navigation %}
<div class="cheeseburger-menu__navigation">
<ul class="cheeseburger-menu__navigation-list">
{% for item in tree %}
<li class="cheeseburger-menu__navigation-list-item cheeseburger-menu__navigation-list-item--{{ item.id }}"
data-drupal-selector="cheeseburger-menu--{{ item.id }}">
{% if item.url %}
<a href="{{ item.url }}">{{ item.navigation_title }}</a>
{% else %}
<span>{{ item.navigation_title }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="cheeseburger-menu__menus">
{% for menu in tree %}
{% if menu['#cheeseburger_ignore'] %}
{{ menu }}
{% else %}
<div class="cheeseburger-menu__menu cheeseburger-menu__menu--{{ menu.id }}"
data-drupal-selector="cheeseburger-menu--{{ menu.id }}">
<span class="cheeseburger-menu__menu-list-trigger"></span>
{% if menu.title != "" %}
<div class="cheeseburger-menu__menu-title{{ menu.collapsible_title }}">{{ menu.title }}</div>
{% endif %}
{% if menu.tree %}
<ul class="cheeseburger-menu__menu-list">
{{ cheesebuger.renderTree(menu.tree, parent_menu_as_link) }}
</ul>
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% macro renderTree(tree, parent_menu_as_link) %}
{% import _self as render_tree %}
{% if tree|length > 0 %}
<ul class="cheeseburger-menu__menu-list">
{% for item in tree %}
{% if item.children|length > 0 %}
<li class="cheeseburger-menu__menu-list-item cheeseburger-menu__menu-list-item--parent cheeseburger-menu__menu-list-item--expanded">
{% else %}
<li class="cheeseburger-menu__menu-list-item cheeseburger-menu__menu-list-item--child">
{% endif %}
{% if item.icon %}
<img src="{{ item.icon }}" class="cheeseburger-menu__menu-list-item-image">
{% endif %}
{% if item.children|length > 0 %}
{% if parent_menu_as_link %}
<span class="cheeseburger-menu__menu-list-item-link cheeseburger-menu__menu-list-item-link--span {{ item.active }}">
<a href="{{ item.url }}" class="cheeseburger-menu__menu-list-item-link {{ item.active }}">{{ item.title }}</a>
</span>
{% else %}
<span class="cheeseburger-menu__menu-list-item-link cheeseburger-menu__menu-list-item-link--span {{ item.active }}">{{ item.title }}</span>
{% endif %}
{% else %}
<a href="{{ item.url }}" class="cheeseburger-menu__menu-list-item-link {{ item.active }}">{{ item.title }}</a>
{% endif %}
{{ render_tree.renderTree(item.children, parent_menu_as_link) }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
File
templates/cheeseburger-menu.html.twig
View source
- {% import _self as cheesebuger %}
- {% if show_navigation %}
- <div class="cheeseburger-menu__navigation">
- <ul class="cheeseburger-menu__navigation-list">
- {% for item in tree %}
- <li class="cheeseburger-menu__navigation-list-item cheeseburger-menu__navigation-list-item--{{ item.id }}"
- data-drupal-selector="cheeseburger-menu--{{ item.id }}">
- {% if item.url %}
- <a href="{{ item.url }}">{{ item.navigation_title }}</a>
- {% else %}
- <span>{{ item.navigation_title }}</span>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
- <div class="cheeseburger-menu__menus">
- {% for menu in tree %}
- {% if menu['#cheeseburger_ignore'] %}
- {{ menu }}
- {% else %}
- <div class="cheeseburger-menu__menu cheeseburger-menu__menu--{{ menu.id }}"
- data-drupal-selector="cheeseburger-menu--{{ menu.id }}">
- <span class="cheeseburger-menu__menu-list-trigger"></span>
- {% if menu.title != "" %}
- <div class="cheeseburger-menu__menu-title{{ menu.collapsible_title }}">{{ menu.title }}</div>
- {% endif %}
- {% if menu.tree %}
- <ul class="cheeseburger-menu__menu-list">
- {{ cheesebuger.renderTree(menu.tree, parent_menu_as_link) }}
- </ul>
- {% endif %}
- </div>
- {% endif %}
- {% endfor %}
- </div>
-
- {% macro renderTree(tree, parent_menu_as_link) %}
- {% import _self as render_tree %}
- {% if tree|length > 0 %}
- <ul class="cheeseburger-menu__menu-list">
- {% for item in tree %}
- {% if item.children|length > 0 %}
- <li class="cheeseburger-menu__menu-list-item cheeseburger-menu__menu-list-item--parent cheeseburger-menu__menu-list-item--expanded">
- {% else %}
- <li class="cheeseburger-menu__menu-list-item cheeseburger-menu__menu-list-item--child">
- {% endif %}
- {% if item.icon %}
- <img src="{{ item.icon }}" class="cheeseburger-menu__menu-list-item-image">
- {% endif %}
- {% if item.children|length > 0 %}
- {% if parent_menu_as_link %}
- <span class="cheeseburger-menu__menu-list-item-link cheeseburger-menu__menu-list-item-link--span {{ item.active }}">
- <a href="{{ item.url }}" class="cheeseburger-menu__menu-list-item-link {{ item.active }}">{{ item.title }}</a>
- </span>
- {% else %}
- <span class="cheeseburger-menu__menu-list-item-link cheeseburger-menu__menu-list-item-link--span {{ item.active }}">{{ item.title }}</span>
- {% endif %}
- {% else %}
- <a href="{{ item.url }}" class="cheeseburger-menu__menu-list-item-link {{ item.active }}">{{ item.title }}</a>
- {% endif %}
- {{ render_tree.renderTree(item.children, parent_menu_as_link) }}
- </li>
- {% endfor %}
- </ul>
- {% endif %}
- {% endmacro %}