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

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