src/Storefront/Resources/views/storefront/layout/navigation/categories.html.twig line 1

  1. {% block layout_navigation_categories %}
  2.     {% set navigationMaxDepth = 3 %}
  3.     {% if not level %}
  4.         {% set level = 0 %}
  5.     {% endif %}
  6.     {% set activeId = page.header.navigation.active.id %}
  7.     {% set activePath = page.header.navigation.active.path %}
  8.     <div class="{% if level == 0 %}row {% endif %}navigation-flyout-categories is-level-{{ level }}">
  9.         {% for treeItem in navigationTree %}
  10.             {% set id = treeItem.category.id %}
  11.             {% set name = treeItem.category.translated.name %}
  12.             {% set link = category_url(treeItem.category) %}
  13.             {% block layout_navigation_categories_item %}
  14.                 <div class="{% if level == 0 %}{% if navigationMedia %}col-4 {% else %}col-3 {% endif %}{% endif %}navigation-flyout-col">
  15.                     {% block layout_navigation_categories_item_link %}
  16.                         {% if treeItem.category.type == 'folder' %}
  17.                             <div class="nav-item nav-link navigation-flyout-link is-level-{{ level }}"
  18.                                  title="{{ name }}">
  19.                                 <span itemprop="name">{{ name }}</span>
  20.                             </div>
  21.                         {% else %}
  22.                             <a class="nav-item nav-link navigation-flyout-link is-level-{{ level }}{% if id == activeId or id in activePath %} active{% endif %}"
  23.                                href="{{ link }}"
  24.                                itemprop="url"
  25.                                {% if category_linknewtab(treeItem.category) %}target="_blank"
  26.                                    {% if treeItem.category.linkType == "external" %}rel="noopener noreferrer"{% endif %}
  27.                                {% endif %}
  28.                                title="{{ name }}">
  29.                                 <span itemprop="name">{{ name }}</span>
  30.                             </a>
  31.                         {% endif %}
  32.                     {% endblock %}
  33.                     {% block layout_navigation_categories_recoursion %}
  34.                         {% if level < navigationMaxDepth %}
  35.                             {% sw_include '@Storefront/storefront/layout/navigation/categories.html.twig' with {
  36.                                 navigationTree: treeItem.children,
  37.                                 level: level + 1,
  38.                                 page: page
  39.                             } only %}
  40.                         {% endif %}
  41.                     {% endblock %}
  42.                 </div>
  43.             {% endblock %}
  44.         {% endfor %}
  45.     </div>
  46. {% endblock %}