templates/includes/header-nav.html.twig line 1

  1. {% set header = content.headerType %}
  2. <header class="header header--{{ header }}" x-data="header">
  3.     <div class="header__container">
  4.         <a href="{{ sulu_content_root_path() }}" class="header__logo">
  5.             <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 298 62">
  6.                 <path d="M198.1 40.178L177.27 0h-14.969v61.223h13.668V21.045l20.83 40.178h14.97V0H198.1v40.178zm96.811-24.92c-2.066-4.608-5.245-8.303-9.556-11.085C281.034 1.39 275.68 0 269.283 0h-23.354v61.223l48.137-13.793c.269-.499.517-.998.755-1.518 2.116-4.64 3.169-9.737 3.169-15.311.01-5.617-1.023-10.724-3.079-15.343zM282.623 39.53c-1.142 2.75-2.851 4.97-5.125 6.658-2.275 1.677-5.047 2.516-8.295 2.516h-9.595V12.52h9.595c3.258 0 6.02.838 8.295 2.527 2.274 1.677 3.983 3.896 5.125 6.646 1.143 2.75 1.709 5.723 1.709 8.92 0 3.185-.566 6.158-1.709 8.918zM74.927 0H61.26l-8.056 61.223H90.95l1.629-12.519H68.5L74.927 0zm42.127 0L95.579 61.223h14.313l3.656-11.478h23.929l3.656 11.478h14.324L133.981 0h-16.927zm.269 37.916l8.195-25.737 8.195 25.737h-16.39zM44.71 2.654C41.58.881 37.558 0 32.62 0H8.056L0 61.223h13.668l2.762-20.875h12.208c4.34 0 8.215-.945 11.632-2.824 3.417-1.88 6.158-4.396 8.215-7.518 2.056-3.132 3.337-6.52 3.824-10.172.487-3.705.12-7.06-1.103-10.044-1.212-2.995-3.387-5.373-6.496-7.136zm-6.149 17.87c-.328 2.432-1.44 4.375-3.337 5.83-1.898 1.454-4.262 2.176-7.083 2.176H17.98l2.116-16h10.172c2.93 0 5.135.668 6.625 1.995 1.49 1.338 2.047 3.334 1.67 6z"
  7.                       fill="currentColor"/>
  8.             </svg>
  9.         </a>
  10.         <div class="header__nav">
  11.             <div class="header__nav-center">
  12.                 {# <!-- Fly-Out Navigation --> #}
  13.                 {% set flyout = flyout() %}
  14.                 {% set currentFlyout = (flyout is not empty and flyout[app.request.locale] is defined) ? flyout[app.request.locale] : [] %}
  15.                 {% set flyoutPages = currentFlyout is not empty ? currentFlyout|keys : [] %}
  16.                 <!-- {{ flyoutPages|join(' --- ') }} -->
  17.                 {# <!-- Fallback --> #}
  18.                 {% if flyout is empty %}
  19.                     <nav class="header-nav">
  20.                         {% for item in sulu_navigation_root_tree('main') %}
  21.                             {% set itemUrl = sulu_content_path(item.url) %}
  22.                             <a class="header-nav__link {{ app.request.uri starts with itemUrl ? 'active' : '' }}"
  23.                                href="{{ sulu_content_path(item.url, item.webspaceKey) }}"
  24.                                title="{{ item.title }}">{{ item.title }}</a>
  25.                         {% endfor %}
  26.                     </nav>
  27.                 {% else %}
  28.                     <nav class="flyout-nav" x-data="flyoutnav">
  29.                         {% set mainNavigation = sulu_navigation_root_tree('main') %}
  30.                         {% for item in mainNavigation %}
  31.                             {% set itemUrl = sulu_content_path(item.url) %}
  32.                             {% set activeNav = app.request.uri starts with itemUrl ? 'active' : '' %}
  33.                             {# <!-- Flyout --> #}
  34.                             {% if flyoutPages is not empty and item.url in flyoutPages %}
  35.                                 <div class="flyout-nav__item {{ activeNav }}" data-flyout title="{{ item.title }}">
  36.                                     {{ item.title }}
  37.                                 </div>
  38.                             {% else %}
  39.                                 {# <!-- Without Flyout - Normal navigation --> #}
  40.                                 <a class="flyout-nav__item {{ activeNav }}"
  41.                                    href="{{ sulu_content_path(item.url, item.webspaceKey) }}" hreflang="{{ app.request.locale }}"
  42.                                    title="{{ item.title }}">{{ item.title }}
  43.                                 </a>
  44.                             {% endif %}
  45.                         {% endfor %}
  46.                         {# <!-- Navigation contents --> #}
  47.                         {% if currentFlyout is not empty %}
  48.                             <div class="flyout-nav__flyout" x-ref="flyout">
  49.                                 <div class="flyout-nav__flyout-inner" x-ref="flyoutInner">
  50.                                     <div class="flyout-nav__background" x-ref="background">
  51.                                         <div class="flyout-nav__arrow" x-ref="arrow"></div>
  52.                                     </div>
  53.                                     {% for item in mainNavigation %}
  54.                                         {% if item.url in flyoutPages %}
  55.                                             {% set flyoutPage = currentFlyout[item.url] %}
  56.                                             {% if flyoutPage['layout'] == 'Layout 1' %}
  57.                                                 {% include '/includes/navigation/layout1.html.twig' %}
  58.                                             {% elseif flyoutPage['layout'] == 'Layout 2' %}
  59.                                                 {% include 'includes/navigation/layout2.html.twig' %}
  60.                                             {% else %}
  61.                                                 {% include 'includes/navigation/layout3.html.twig' %}
  62.                                             {% endif %}
  63.                                         {% endif %}
  64.                                     {% endfor %}
  65.                                 </div>
  66.                             </div>
  67.                         {% endif %}
  68.                     </nav>
  69.                 {% endif %}
  70.             </div>
  71.             <div class="header__nav-right">
  72.                 <div class="languageswitch" x-data="languageswitch">
  73.                     <div class="languageswitch__button">
  74.                         <span class="languageswitch__button-inner">
  75.                             <span class="languageswitch__button-arrow">
  76.                                <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">
  77.                                  <path d="M7.5 14.5c1.657 0 3-3.134 3-7s-1.343-7-3-7-3 3.134-3 7 1.343 7 3 7ZM.5 7.5h14"
  78.                                        stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
  79.                                  <path d="M7.5 14.5a7 7 0 1 0 0-14 7 7 0 0 0 0 14Z" stroke="currentColor" stroke-linecap="round"
  80.                                        stroke-linejoin="round"/>
  81.                                </svg>
  82.                             </span>
  83.                             {{ app.request.getLocale()|upper }}
  84.                         </span>
  85.                         <select class="languageswitch__select" x-ref="select">
  86.                             {% for localization in localizations %}
  87.                                 <option value="{{ localization.url }}"
  88.                                         {% if localization.locale == app.request.getLocale() %} selected {% endif %}>
  89.                                     {{ localization.locale|upper }}
  90.                                 </option>
  91.                             {% endfor %}
  92.                         </select>
  93.                     </div>
  94.                 </div>
  95.             </div>
  96.         </div>
  97.         <div class="header__actions">
  98.             <div class="languageswitch" x-data="languageswitch">
  99.                 <div class="languageswitch__button">
  100.                         <span class="languageswitch__button-inner">
  101.                             <span class="languageswitch__button-arrow">
  102.                                <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">
  103.                                  <path d="M7.5 14.5c1.657 0 3-3.134 3-7s-1.343-7-3-7-3 3.134-3 7 1.343 7 3 7ZM.5 7.5h14"
  104.                                        stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
  105.                                  <path d="M7.5 14.5a7 7 0 1 0 0-14 7 7 0 0 0 0 14Z" stroke="currentColor" stroke-linecap="round"
  106.                                        stroke-linejoin="round"/>
  107.                                </svg>
  108.                             </span>
  109.                             {{ app.request.getLocale()|upper }}
  110.                         </span>
  111.                     <select class="languageswitch__select" x-ref="select">
  112.                         {% for localization in localizations %}
  113.                             <option value="{{ localization.url }}"
  114.                                     {% if localization.locale == app.request.getLocale() %} selected {% endif %}>
  115.                                 {{ localization.locale|upper }}
  116.                             </option>
  117.                         {% endfor %}
  118.                     </select>
  119.                 </div>
  120.             </div>
  121.             <a href="#" class="header__action" @click="showMobileNav = true">
  122.                 <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
  123.                     <path d="M1.5 2.5h14" stroke="currentColor" stroke-miterlimit="10" stroke-linecap="round"
  124.                           stroke-linejoin="round"/>
  125.                     <path d="M1.5 8.5h14M1.5 14.5h14" stroke="currentColor" stroke-miterlimit="10"
  126.                           stroke-linecap="round" stroke-linejoin="round"/>
  127.                 </svg>
  128.             </a>
  129.         </div>
  130.     </div>
  131.     <div class="header__mobile-nav">
  132.         {{ include('/includes/mobile-nav.html.twig') }}
  133.     </div>
  134. </header>