templates/includes/side-navigation/menue.html.twig line 1

Open in your IDE?
  1. {#}
  2. <?php
  3. /**
  4.  * @var $contacts array
  5.  * @var $this \Pimcore\Templating\PhpEngine 
  6.  */
  7. $document $this->document;
  8. if(!$document instanceof \Pimcore\Model\Document\Page) {
  9.     $document \Pimcore\Model\Document\Page::getById(21);
  10. }
  11. $lang 'de'//$document->getProperty('language');
  12. $langSwitch $lang === 'de' 'EN' 'DE';
  13. $href $lang === 'de' '/en' '/de';
  14. ?>
  15. #}
  16. {% set alternateLanguagePath = document.getProperty('alternateLanguagePath') %}
  17. {% set lang = document.getProperty('language') %}
  18. {% if lang == 'en' %}
  19.   {% set otherLang = 'de' %}
  20. {% else %}
  21.   {% set otherLang = 'en' %}
  22. {% endif %}
  23. <script>
  24.     function changeLang(language) {
  25.         Cookies.set('language', language, {expires: 14});
  26.         {% if alternateLanguagePath %}
  27.             const fullUrl = '{{ app.request.getSchemeAndHttpHost() ~ alternateLanguagePath.getFullPath() }}';
  28.             window.location.assign(fullUrl);
  29.         {% else %}
  30.             let urlPath = "{{ app.request.requestUri() | replace({'/en/': '/', '/de/': '/'}) }}";
  31.             if(urlPath == '/en') {
  32.                 urlPath = '';
  33.             }
  34.             const dePage = '{{ app.request.getSchemeAndHttpHost() }}' + urlPath;
  35.             const enPage = '{{ startseiteEN }}' + urlPath;
  36.             window.location.assign(language == 'de' ? dePage : enPage);
  37.         {% endif %}
  38.     }
  39. </script>
  40. <div class="menue-wrapper">
  41.     <div class="inline-wrapper">
  42.         <div style="display: flex; align-items: center; justify-content: center;" class="icon">
  43.             <p style="margin-bottom: 0; display: flex; text-transform: uppercase;"><span>{{ lang }}</span>/<span onclick="changeLang('{{ otherLang }}')" style="cursor: pointer;">{{ otherLang }}</span></p>
  44.         </div>
  45.         {% for item in contacts %}
  46.             <div class="icon">{{ item | raw }}</div>
  47.         {% endfor %}
  48.         <div class="icon search">
  49.             {{ include('includes/side-navigation/search-form.html.twig') }}
  50.         </div>
  51.         <div class="icon">
  52.             <a href="{{ wetterLink }}" >
  53.                 <img class="wetter-img" width="45" height="45" src="{{ wetterIcon }}"  alt=""/>
  54.             </a>
  55.         </div>
  56.         <div style="width: 25px; height: 25px; margin-right: 0;" class="icon">
  57.             {{ include('includes/side-navigation/burger.html.twig') }}
  58.         </div>
  59.     </div>
  60. </div>