vendor/shopware/storefront/Resources/views/storefront/layout/navigation/navigation.html.twig line 1

Open in your IDE?
  1. {% block layout_main_navigation %}
  2.     <div class="main-navigation"
  3.          id="mainNavigation"
  4.          data-flyout-menu="true">
  5.         {% block layout_main_navigation_navbar %}
  6.             <div class="container">
  7.                 {% block layout_main_navigation_menu %}
  8.                     <nav class="nav main-navigation-menu"
  9.                         itemscope="itemscope"
  10.                         itemtype="http://schema.org/SiteNavigationElement">
  11.                         {% set homeLabel = context.salesChannel.translated.homeName|default("general.homeLink"|trans) %}
  12.                         {% block layout_main_navigation_menu_home %}
  13.                             {% if context.salesChannel.translated.homeEnabled %}
  14.                                 <a class="nav-link main-navigation-link{% if controllerAction is same as('home') %} active{% endif %} home-link"
  15.                                     href="{{ path('frontend.home.page') }}"
  16.                                     itemprop="url"
  17.                                     title="{{ homeLabel|striptags }}">
  18.                                     <div class="main-navigation-link-text">
  19.                                         <span itemprop="name">{{ homeLabel|sw_sanitize }}</span>
  20.                                     </div>
  21.                                 </a>
  22.                             {% endif %}
  23.                         {% endblock %}
  24.                         {% block layout_main_navigation_menu_items %}
  25.                             {% if page.product is defined %}
  26.                                 {% set activePath = page.product.categoryTree %}
  27.                             {% else %}
  28.                                 {% set activePath = page.header.navigation.active.path %}
  29.                             {% endif %}
  30.                             {% for treeItem in page.header.navigation.tree %}
  31.                                 {% set category = treeItem.category %}
  32.                                 {% set name = category.translated.name %}
  33.                                 {# @deprecated tag:v6.5.0 - Use "category.id" directly instead. #}
  34.                                 {% set categorId = category.id %}
  35.                                 {% block layout_main_navigation_menu_item %}
  36.                                     {% if category.type == 'folder' %}
  37.                                         <div class="nav-link main-navigation-link"
  38.                                             {% if treeItem.children|length > 0 %}
  39.                                                 data-flyout-menu-trigger="{{ category.id }}"
  40.                                             {% endif %}
  41.                                               title="{{ name }}">
  42.                                             <div class="main-navigation-link-text">
  43.                                                 <span itemprop="name">{{ name }}</span>
  44.                                             </div>
  45.                                         </div>
  46.                                     {% else %}
  47.                                         <a class="nav-link main-navigation-link{% if category.id == page.header.navigation.active.id or category.id in activePath %} active{% endif %}"
  48.                                            href="{{ category_url(category) }}"
  49.                                            itemprop="url"
  50.                                            {% if treeItem.children|length > 0 %}data-flyout-menu-trigger="{{ category.id }}"{% endif %}
  51.                                            {% if category_linknewtab(category) %}target="_blank"{% endif %}
  52.                                            title="{{ name }}">
  53.                                             <div class="main-navigation-link-text">
  54.                                                 <span itemprop="name">{{ name }}</span>
  55.                                             </div>
  56.                                         </a>
  57.                                     {% endif %}
  58.                                 {% endblock %}
  59.                             {% endfor %}
  60.                         {% endblock %}
  61.                     </nav>
  62.                 {% endblock %}
  63.             </div>
  64.         {% endblock %}
  65.         {% block layout_main_navigation_menu_flyout_wrapper %}
  66.             {% set navigationChildrenCount = 0 %}
  67.             {% for treeItem in page.header.navigation.tree %}
  68.                 {% if treeItem.category.childCount > 0 %}
  69.                     {% set navigationChildrenCount = navigationChildrenCount + 1 %}
  70.                 {% endif %}
  71.             {% endfor %}
  72.             {% if navigationChildrenCount > 0 %}
  73.                 {% block layout_main_navigation_menu_flyout_container %}
  74.                     <div class="navigation-flyouts">
  75.                         {% block layout_main_navigation_menu_flyouts %}
  76.                             {% for treeItem in page.header.navigation.tree %}
  77.                                 {% if treeItem.children|length > 0 %}
  78.                                     {% block layout_main_navigation_menu_flyout %}
  79.                                         <div class="navigation-flyout"
  80.                                              data-flyout-menu-id="{{ treeItem.category.id }}">
  81.                                             <div class="container">
  82.                                                 {% block layout_main_navigation_menu_flyout_include %}
  83.                                                     {% sw_include '@Storefront/storefront/layout/navigation/flyout.html.twig' with {navigationTree: treeItem, level: level+1, page: page} only %}
  84.                                                 {% endblock %}
  85.                                             </div>
  86.                                         </div>
  87.                                     {% endblock %}
  88.                                 {% endif %}
  89.                             {% endfor %}
  90.                         {% endblock %}
  91.                     </div>
  92.                 {% endblock %}
  93.             {% endif %}
  94.         {% endblock %}
  95.     </div>
  96. {% endblock %}