templates/segments/header.html.twig line 1

Open in your IDE?
  1. <div id="header">
  2.     {% if editmode %}
  3.     {# {% spaceless %} #}
  4.     {# add global stylesheets and scripts outside of any blocsk to add them to the helpers before any others assets are added #}
  5.     {# we use the view helper to have cache buster functionality #}
  6.     {% do pimcore_head_link().appendStylesheet(asset('static/css/index.css')) %}
  7.     {% do pimcore_head_script().appendFile(asset('static/js/index.js')) %}
  8.     {# {% endspaceless %} #}
  9.     {% block head_stylesheets deferred %}
  10.     {{ pimcore_head_link() }}
  11.     {% endblock %}
  12.     {% block scripts deferred %}
  13.     {{ pimcore_head_script() }}
  14.     {% endblock %}
  15.     {% endif %}
  16.     {# get root node if there is no document defined (for pages which are routed directly through static route) #}
  17.     {% if not document is defined or not document %}
  18.         {% set document = pimcore_document(1) %}
  19.     {% endif %}
  20.     {# get the document which should be used to start in navigation | default home #}
  21.     {% set navStartNode = document.getProperty('navigationRoot') %}
  22.     {% if not navStartNode is instanceof('\\Pimcore\\Model\\Document\\Page') %}
  23.         {% set navStartNode = pimcore_document_by_path('/' ~ app.request.getLocale()) %}
  24.     {% endif %}
  25.     {% set mainNavigation = pimcore_build_nav({
  26.         active: document,
  27.         root: navStartNode
  28.     }) %}
  29.     <header>
  30.         {# ............................................................................................. #}
  31.         {% if realDocument is defined %}
  32.             {% set doc = realDocument %}
  33.         {% else %}
  34.             {% set doc = document %}
  35.         {% endif %}
  36.         {# ............................................................................................. #}
  37.         <nav class="navbar navbar-expand-lg navbar-light">
  38.             <div class="container navbar-special-class">
  39.                 <a class="navbar-brand" href="/{{ app.request.getLocale() }}">
  40.                     {% if not pimcore_image('logo_header').isEmpty() and not editmode %}
  41.                         {{ pimcore_image('logo_header').getThumbnail('logo_header').getHtml({class: 'img-fluid'}) | raw  }}
  42.                     {% else %}
  43.                         {{ pimcore_image('logo_header') }}
  44.                     {% endif %}
  45.                 </a>
  46.                 <div class="navbar-buttons">
  47.                     <button type="button" class="search-button search-button--mobile">
  48.                         <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
  49.                             <circle cx="5.5" cy="5.5" r="4.5" stroke="white" stroke-width="2"/>
  50.                             <rect x="9.41406" y="8" width="8" height="2" rx="1" transform="rotate(45 9.41406 8)" fill="white"/>
  51.                         </svg>
  52.                     </button>
  53.                     <button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
  54.                         <span class="navbar-toggler-icon"></span>
  55.                     </button>
  56.                 </div>
  57.                 <form action="/{{ app.request.getLocale() }}/search" method="get" class="search-form search-form--mobile">
  58.                     <input type="text" class="search-input" name="term" placeholder="{{ 'Pretraži' | trans }}">
  59.                     <div class="search-close"></div>
  60.                 </form>
  61.                 <div class="collapse navbar-collapse align-items-center justify-content-end" id="navbarNav">
  62.                     <ul class="navbar-nav align-items-center justify-content-end position-relative">
  63.                         <li class="nav-item btn-download-header-wrapper--mobile">
  64.                             <div class="h5 text-uppercase">{{ 'DOWNLOAD' | trans }}</div>
  65.                             <div class="app-buttons">
  66.                                 {% include 'components/google-play-button.html.twig' %}
  67.                                 {% include 'components/app-store-button.html.twig' %}
  68.                             </div>
  69.                         </li>
  70.                         
  71.                         {% for nav in mainNavigation %}
  72.                             {% if nav._visible %}
  73.                                 <li class="nav-item">
  74.                                     <a class="nav-link {{ nav.class }}
  75.                                     {{ nav.label == 'blog-posts' and blogPostId is defined and blogPostId is not empty ? 'active' }}"
  76.                                     href="{{ nav.uri }}">
  77.                                         <span class="h5">
  78.                                             {{ nav.title }}
  79.                                         </span>
  80.                                     </a>
  81.                                 </li>
  82.                             {% endif %}
  83.                         {% endfor %}
  84.                         <li>
  85.                             <button type="button" class="search-button search-button--desktop">
  86.                                 <svg width="18" height="18" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
  87.                                     <circle cx="5.5" cy="5.5" r="4.5" stroke="white" stroke-width="2"/>
  88.                                     <rect x="9.41406" y="8" width="8" height="2" rx="1" transform="rotate(45 9.41406 8)" fill="white"/>
  89.                                 </svg>
  90.                             </button>
  91.                         </li>
  92.                         <li class="nav-item nav-item-language--mobile">
  93.                             {% if blogPostId is defined %}
  94.                                 {% for key,link in get_localized_links(doc, blogPostId) %}
  95.                                     <a href="{{ link.link }}" class="nav-link {{ app.request.getLocale == key  ? 'text-main-green'}}">
  96.                                         {{ link.text }}
  97.                                     </a>
  98.                                 {% endfor %}
  99.                             {% else %}
  100.                                 {% for key,link in get_localized_links(doc) %}
  101.                                     <a href="{{ link.link }}" class="nav-link {{ app.request.getLocale == key  ? 'text-main-green'}}">
  102.                                         {{ link.text }}
  103.                                     </a>
  104.                                 {% endfor %}
  105.                             {% endif %}
  106.                         </li>
  107.                         <li class="nav-item mt-auto d-block d-lg-none">
  108.                             <p class="h6 navbar-bottom-text text-light-purple">
  109.                                 {{ '©Copyright Meddox' | trans }} <script>document.write(new Date().getFullYear())</script>
  110.                                 <br>
  111.                                 {% if not editmode %}
  112.                                     {% for i in pimcore_iterate_block(pimcore_block("meddoxHeaderLinks", {class: 'd-flex'})) %}
  113.                                         {{ pimcore_link('mobile-menu-link-' ~ i, {class: 'text-light-purple mr-1'}) }}
  114.                                     {% endfor %}
  115.                                 {% endif %}
  116.                                 <a href="mailto:{{ pimcore_input('mail_to_header').getData() }}" class="text-light-purple">
  117.                                     {{ pimcore_input('mail_to_header').getData() }}
  118.                                 </a>
  119.                             </p>
  120.                         </li>
  121.                         <li>
  122.                             <form action="/{{ app.request.getLocale() }}/search" method="get" class="search-form search-form--desktop">
  123.                                 <input type="text" class="search-input" name="term" placeholder="{{ 'Pretraži' | trans }}">
  124.                                 <div class="search-close"></div>
  125.                             </form>
  126.                         </li>
  127.                     </ul>
  128.                     <ul class="navbar-nav navbar-nav--desktop align-items-center justify-content-end">
  129.                         <li class="nav-item btn-download-header-wrapper">
  130.                             <span class="nav-link dropdown nav-dropdown">
  131.                                 <div class="btn btn-primary dropdown-toggle" role="button" id="dropdownMenu" data-toggle="dropdown" aria-expanded="false">{{ 'DOWNLOAD' | trans }}</div>
  132.                                 <div class="dropdown-menu" aria-labelledby="dropdownMenu">
  133.                                     <div class="dropdown-item">
  134.                                         <a href="{{ pimcore_website_config('GooglePlayDownloadLink') }}" target="_blank" title="{{ 'Google Play' | trans }}" class="h5">{{ 'Google Play' | trans }}</a>
  135.                                     </div>
  136.                                     <div class="dropdown-item">
  137.                                         <a href="{{ pimcore_website_config('AppStoreDownloadLink') }}" target="_blank" title="{{ 'App Store' | trans }}" class="h5">{{ 'App Store' | trans }}</a>
  138.                                     </div>
  139.                                 </div>
  140.                             </span>
  141.                         </li>
  142.                         <li class="nav-item nav-item-language nav-item-language-init">
  143.                             <a href="javascript:;" class="nav-link language-switcher-wrapper">
  144.                                 <select name="language-select" id="language-select">
  145.                                     {% if blogPostId is defined %}
  146.                                         {% for key,link in get_localized_links(doc, blogPostId) %}
  147.                                             <option value="{{ key }}" data-link="{{ link.link }}" {{ app.request.getLocale == key  ? 'selected'}}>
  148.                                                 {{ link.text }}
  149.                                             </option>
  150.                                         {% endfor %}
  151.                                     {% else %}
  152.                                         {% for key,link in get_localized_links(doc) %}
  153.                                             <option value="{{ key }}" data-link="{{ link.link }}" {{ app.request.getLocale == key  ? 'selected'}}>
  154.                                                 {{ link.text }}
  155.                                             </option>
  156.                                         {% endfor %}
  157.                                     {% endif %}
  158.                                 </select>
  159.                             </a>
  160.                         </li>
  161.                     </ul>
  162.                 </div>
  163.             </div>
  164.             {% for type, message in app.session.flashbag.all() %}
  165.                 {% include 'components/alerts-modals/message-bar.html.twig' with {
  166.                     type: type,
  167.                     message: message,
  168.                     dismissible: true
  169.                 } %}
  170.             {% endfor %}
  171.         </nav>
  172.     </header>
  173.     {% if editmode %}
  174.         <div class="row">
  175.             <div class="col-lg-2">
  176.                 <div class="mt-3 p-2 rounded font-weight-light d-flex flex-column ml-4 bg-light-purple">
  177.                     <span class="font-italic mb-2 text-white">{{ 'Mail to in mobile menu' | trans }}</span>
  178.                     {{ pimcore_input('mail_to_header', {placeholder:  'Mail to...', 'width': 180, 'class' : 'text-white'}) }}
  179.                 </div>
  180.             </div>
  181.             <div class="col-lg-6">
  182.                 {% for i in pimcore_iterate_block(pimcore_block("meddoxHeaderLinks", {class: 'd-flex'})) %}
  183.                     {{ pimcore_link('mobile-menu-link-' ~ i) }}
  184.                 {% endfor %}
  185.             </div>
  186.         </div>
  187.     {% endif %}
  188. </div>