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.                             {% set activePath = page.header.navigation.active.path %}
  26.                             {% for treeItem in page.header.navigation.tree %}
  27.                                 {% set category = treeItem.category %}
  28.                                 {% set name = category.translated.name %}
  29.                                 {# @deprecated tag:v6.5.0 - Use "category.id" directly instead. #}
  30.                                 {% set categorId = category.id %}
  31.                                 {% block layout_main_navigation_menu_item %}
  32.                                     {% if category.type == 'folder' %}
  33.                                         <div class="nav-link main-navigation-link"
  34.                                             {% if treeItem.children|length > 0 %}
  35.                                                 data-flyout-menu-trigger="{{ category.id }}"
  36.                                             {% endif %}
  37.                                               title="{{ name }}">
  38.                                             <div class="main-navigation-link-text">
  39.                                                 <span itemprop="name">{{ name }}</span>
  40.                                             </div>
  41.                                         </div>
  42.                                     {% else %}
  43.                                         <a class="nav-link main-navigation-link{% if category.id == page.header.navigation.active.id or category.id in activePath %} active{% endif %}"
  44.                                            href="{{ category_url(category) }}"
  45.                                            itemprop="url"
  46.                                            {% if treeItem.children|length > 0 %}data-flyout-menu-trigger="{{ category.id }}"{% endif %}
  47.                                            {% if category_linknewtab(category) %}target="_blank"{% endif %}
  48.                                            title="{{ name }}">
  49.                                             <div class="main-navigation-link-text">
  50.                                                 <span itemprop="name">{{ name }}</span>
  51.                                             </div>
  52.                                         </a>
  53.                                     {% endif %}
  54.                                 {% endblock %}
  55.                             {% endfor %}
  56.                         {% endblock %}
  57.                     </nav>
  58.                 {% endblock %}
  59.             </div>
  60.         {% endblock %}
  61.         {% block layout_main_navigation_menu_flyout_wrapper %}
  62.             {% set navigationChildrenCount = 0 %}
  63.             {% for treeItem in page.header.navigation.tree %}
  64.                 {% if treeItem.category.childCount > 0 %}
  65.                     {% set navigationChildrenCount = navigationChildrenCount + 1 %}
  66.                 {% endif %}
  67.             {% endfor %}
  68.             {% if navigationChildrenCount > 0 %}
  69.                 {% block layout_main_navigation_menu_flyout_container %}
  70.                     <div class="navigation-flyouts">
  71.                         {% block layout_main_navigation_menu_flyouts %}
  72.                             {% for treeItem in page.header.navigation.tree %}
  73.                                 {% if treeItem.children|length > 0 %}
  74.                                     {% block layout_main_navigation_menu_flyout %}
  75.                                         <div class="navigation-flyout"
  76.                                              data-flyout-menu-id="{{ treeItem.category.id }}">
  77.                                             <div class="container">
  78.                                                 {% block layout_main_navigation_menu_flyout_include %}
  79.                                                     {% sw_include '@Storefront/storefront/layout/navigation/flyout.html.twig' with {navigationTree: treeItem, level: level+1, page: page} only %}
  80.                                                 {% endblock %}
  81.                                             </div>
  82.                                         </div>
  83.                                     {% endblock %}
  84.                                 {% endif %}
  85.                             {% endfor %}
  86.                         {% endblock %}
  87.                     </div>
  88.                 {% endblock %}
  89.             {% endif %}
  90.         {% endblock %}
  91.     </div>
  92. {% endblock %}