custom/plugins/TcinnThemeWareClean/src/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/base.html.twig' %}
  2. {# TODO: prüfen... #}
  3. {# ---------------- START: SET TEMPLATE VARS ---------------- #}
  4. {# ThemeWare: Set theme variables #}
  5. {% set twtContainerLayout = theme_config('twt-container-layout') %}
  6. {% set twtAdditionalJsFile = theme_config('twt-additional-js-file') %}
  7. {% set twtAdditionalJsFileAsync = theme_config('twt-additional-js-file-async') %}
  8. {% set twtAdditionalJsFileLoad = theme_config('twt-additional-js-file-load') %}
  9. {% set twtAnnoncementBannerShow = theme_config('twt-annoncement-banner-show') %}
  10. {% set twtBodyClass = theme_config('twt-body-class') %}
  11. {% set twtBodyClassCmsPageId = theme_config('twt-body-class-cms-page-id') %}
  12. {% set twtContainerLayout = theme_config('twt-container-layout') %}
  13. {% set twtContainerMaxWidth = theme_config('twt-container-max-width') %}
  14. {% set twtCustomJsCode = theme_config('twt-custom-js-code') %}
  15. {% set twtExpertMode = theme_config('twt-expert-mode') %}
  16. {% set twtFloatingWidgetAnimation = theme_config('twt-floating-widget-animation') %}
  17. {% set twtFloatingWidgetBackdrop = theme_config('twt-floating-widget-backdrop') %}
  18. {% set twtFloatingWidgetShow = theme_config('twt-floating-widget-show') %}
  19. {% set twtFloatingWidgetShowOpened = theme_config('twt-floating-widget-show-opened') %}
  20. {% set twtHeaderLogoType = theme_config('twt-header-logo-type') %}
  21. {% set twtHeaderSearchType = theme_config('twt-header-search-type') %}
  22. {% set twtHeaderType = theme_config('twt-header-type') %}
  23. {% set twtLicensekey = theme_config('twt-footer-lizenzkey') %}
  24. {% set twtShoppingExperiencesHeaderPosition = theme_config('twt-shopping-experiences-header-position') %}
  25. {% set twtSlideoutCommunitiesShow = theme_config('twt-slideout-communities-show') %}
  26. {% set twtStickyNavMainBreakpoint = theme_config('twt-sticky-nav-main-breakpoint') %}
  27. {% set twtStickyNavMainCartShow = theme_config('twt-sticky-nav-main-cart-show') %}
  28. {% set twtStickyNavMainLogoImage = theme_config('twt-sticky-nav-main-logo-image') %}
  29. {% set twtStickyNavMainLogoShow = theme_config('twt-sticky-nav-main-logo-show') %}
  30. {% set twtStickyNavMainScrollTop = theme_config('twt-sticky-nav-main-scroll-top') %}
  31. {% set twtStickyNavMainSearchShow = theme_config('twt-sticky-nav-main-search-show') %}
  32. {% set twtStickyNavMainShow = theme_config('twt-sticky-nav-main-show') %}
  33. {% set twtStickyNavMainToggle = theme_config('twt-sticky-nav-main-toggle') %}
  34. {% set twtStickyNavMainType = theme_config('twt-sticky-nav-main-type') %}
  35. {% set twtHeaderPhoneFixed = theme_config('twt-header-phone-fixed') %}
  36. {% set twtUspBarFooter = theme_config('twt-usp-bar-footer') %}
  37. {% set twtUspBarFooterPosition = theme_config('twt-usp-bar-footer-position') %}
  38. {% set twtUspBarHeader = theme_config('twt-usp-bar-header') %}
  39. {% set twtUspBarHeaderPosition = theme_config('twt-usp-bar-header-position') %}
  40. {# ---------------- END: SET TEMPLATE VARS ---------------- #}
  41. {# ThemeWare: Set custom fields #}
  42. {% set twtCustomFields = {
  43.     category: page.header.navigation.active.translated.customFields,
  44.     product: page.product.translated.customFields
  45. } %}
  46. {# ThemeWare: Set "Shopping Experiences Header" variable #}
  47. {% set twtShoppingExperiencesHeader = false %}
  48. {% if twtShoppingExperiencesHeaderPosition == 2 %}
  49.     {# ThemeWare: Allow "Shopping Experiences Header" on the home page or in listings via a custom-field #}
  50.     {% if controllerAction is same as('home') %}
  51.         {# ThemeWare: Allow "Shopping Experiences Header" on the home page #}
  52.         {% set twtShoppingExperiencesHeader = true %}
  53.     {% elseif controllerName|lower is same as('navigation') %}
  54.         {# ThemeWare: Allow "Shopping Experiences Header" in listing pages via a custom-field #}
  55.         {% if twtCustomFields.category.twt_clean_pro_custom_field__category__shopping_experiences_header is not empty and twtCustomFields.category.twt_clean_pro_custom_field__category__shopping_experiences_header == "1" %}
  56.             {% set twtShoppingExperiencesHeader = true %}
  57.         {% endif %}
  58.     {% endif %}
  59. {% endif %}
  60. {# TODO: prüfen... #}
  61. {# TODO: Kommentare formatieren, Blöcke mit TW #}
  62. {% block base_body_inner %}
  63.     {% set tcinn = true %}
  64.     {% if twtLicensekey %}
  65.         {% set twtLicensekeyValues = {} %}
  66.         {% for letter in 0..9 %}
  67.             {% set twtLicensekeyValues = twtLicensekeyValues|merge({
  68.                 (letter): (loop.index + 47)
  69.             }) %}
  70.         {% endfor %}
  71.         {% for letter in 'A'..'Z' %}
  72.             {% set twtLicensekeyValues = twtLicensekeyValues|merge({
  73.                 (letter): (loop.index + 64)
  74.             }) %}
  75.         {% endfor %}
  76.         {% for letter in 'a'..'z' %}
  77.             {% set twtLicensekeyValues = twtLicensekeyValues|merge({
  78.                 (letter): (loop.index + 96)
  79.             }) %}
  80.         {% endfor %}
  81.         {% set twtLicensekeySum = 0 %}
  82.         {% for char in twtLicensekey|replace({'-': ''})|split('') %}
  83.             {% set twtLicensekeySum = (twtLicensekeySum + (twtLicensekeyValues[char] * (loop.index-1))) %}
  84.         {% endfor %}
  85.         {% if twtLicensekeySum == 11000 or (twtLicensekey starts with 'TL' and twtLicensekey|length == 16) %}
  86.             {% set tcinn = false %}
  87.         {% endif %}
  88.     {% endif %}
  89.     {# ThemeWare: Add additional wrapper in the body for boxed layouts #}
  90.     {% if twtContainerLayout == 3 %}
  91.         <div class="container body-container">{{ parent() }}</div>
  92.     {% else %}
  93.         {# Default block #}
  94.         {{ parent() }}
  95.     {% endif %}
  96. {% endblock %}
  97. {# ThemeWare: Set body classes (reverse order) #}
  98. {% set bodyClasses = [] %}
  99.     {# ThemeWare: Apply category class #}
  100.     {% if twtCustomFields.category.twt_clean_pro_custom_field__category__body_class is not empty %}
  101.         {% set bodyClasses = [twtCustomFields.category.twt_clean_pro_custom_field__category__body_class|lower]|merge(bodyClasses) %}
  102.     {% endif %}
  103.     {# ThemeWare: Theme body class #}
  104.     {% if twtBodyClass and twtExpertMode == 2 %}
  105.         {% set bodyClasses = [twtBodyClass]|merge(bodyClasses) %}
  106.     {% endif %}
  107.     {# ThemeWare: Theme logged-in class #}
  108.     {% if context.customer is not empty %}{% set bodyClasses = ['twt-logged-in']|merge(bodyClasses) %}{% endif %}
  109.     {# ThemeWare: Add CMS-Page-ID #}
  110.     {% if page.cmsPage.type != NULL %}
  111.         {% if twtBodyClassCmsPageId == 2 %}
  112.             {% set bodyClasses = ['twt-cms-id-' ~ page.cmsPage.id]|merge(bodyClasses) %}
  113.         {% endif %}
  114.         {% if twtBodyClassCmsPageId == 3 %}
  115.             {% set bodyClasses = ['twt-cms-id-' ~ page.cmsPage.id|slice(0, 7)]|merge(bodyClasses) %}
  116.         {% endif %}
  117.     {% endif %}
  118.     {# ThemeWare: Add CMS-Pagetype #}
  119.     {% if page.cmsPage.type != NULL %}
  120.         {% set bodyClasses = ['twt-is-cms-' ~ page.cmsPage.type|replace({ "_":"-" })]|merge(bodyClasses) %}
  121.     {% endif %}
  122.     {# ThemeWare: Add container layout #}
  123.     {% if twtContainerLayout == 1 %}
  124.         {% set bodyClasses = ['twt-full-width']|merge(bodyClasses) %}
  125.     {% elseif twtContainerLayout == 2 %}
  126.         {% set bodyClasses = ['twt-full-width-boxed']|merge(bodyClasses) %}
  127.     {% elseif twtContainerLayout == 3 %}
  128.         {% set bodyClasses = ['twt-boxed']|merge(bodyClasses) %}
  129.     {% endif %}
  130.     {# ThemeWare: Apply "Shopping experience header" class #}
  131.     {% if twtShoppingExperiencesHeader %}
  132.         {% set bodyClasses = ['twt-shopping-experiences-header']|merge(bodyClasses) %}
  133.     {% endif %}
  134.     {# ThemeWare: Add header type #}
  135.     {% if twtHeaderType %}
  136.         {% set bodyClasses = ['twt-header-type-' ~ twtHeaderType]|merge(bodyClasses) %}
  137.     {% endif %}
  138.     {# ThemeWare: Theme variant class #}
  139.     {% set bodyClasses = ['twt-clean']|merge(bodyClasses) %}
  140.     {# ThemeWare: ThemeWare class #}
  141.     {% set bodyClasses = ['themeware']|merge(bodyClasses) %}
  142. {# ThemeWare: Add body classes
  143.     - Replace: tab, new line, return, NUL-byte, vertical tab
  144. #}
  145. {% block base_body_classes %}{{ parent() }}{% apply replace({"\t":"", "\n":"", "\r":"", "\0":"", "\x0B":"", "\r\n":""}) %} {{ bodyClasses|join(' ') }}{% endapply %}{% endblock %}
  146. {# ThemeWare: Add/change header #}
  147. {% block base_header %}
  148.     {# ThemeWare: "Ankündigungsbanner" ergänzen. #}
  149.     {% if twtAnnoncementBannerShow > 1 %}
  150.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-announcement-banner.html.twig' ignore missing with {
  151.             type: 'header',
  152.             alignment: 'top',
  153.             close: 'false'
  154.         } %}
  155.     {% endif %}
  156.     {# ThemeWare: "USP-Bar" über dem Header ergänzen. #}
  157.     {% if twtUspBarHeader > 1 and twtUspBarHeaderPosition == 1 %}
  158.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  159.             type: 'header',
  160.             alignment: 'top'
  161.         } %}
  162.     {% endif %}
  163.     {# Default block #}
  164.     {{ parent() }}
  165.     {# ThemeWare: "USP-Bar" über der Navigation ergänzen. #}
  166.     {% if twtUspBarHeader > 1 and twtUspBarHeaderPosition == 2 %}
  167.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  168.             type: 'header'
  169.         } %}
  170.     {% endif %}
  171. {% endblock %}
  172. {# ThemeWare: Adjustments on base footer #}
  173. {% block base_footer %}
  174.     {# ThemeWare: "USP-Bar" über dem Footer ergänzen. #}
  175.     {% if twtUspBarFooter > 1 and twtUspBarFooterPosition == 1 %}
  176.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  177.             type: 'footer'
  178.         } %}
  179.     {% endif %}
  180.     {# Default block #}
  181.     {{ parent() }}
  182.     {# ThemeWare: "Slideout-Communities" zum Footer hinzufügen. #}
  183.     {# TODO: Add configuration #}
  184.     {% if twtSlideoutCommunitiesShow == 2 %}
  185.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-slideout-communities.html.twig' ignore missing %}
  186.     {% endif %}
  187.     {# ThemeWare: "Floating-Widget" zum Footer hinzufügen. #}
  188.     {% if twtFloatingWidgetShow == 2 %}
  189.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-floating-widget.html.twig' ignore missing with {
  190.             open: twtFloatingWidgetShowOpened,
  191.             animation: twtFloatingWidgetAnimation,
  192.             backdrop: twtFloatingWidgetBackdrop
  193.         } %}
  194.     {% endif %}
  195. {% endblock %}
  196. {# ThemeWare: Adjustments on the main navigation #}
  197. {# TODO: Check compatibility #}
  198. {% block base_navigation %}
  199.     {# ThemeWare: Block leeren wenn "Header 10" aktiv ist. Andernfalls werden Anpassungen für unsere Basis-Header vorgenommen.   #customHeader #}
  200.     {% if twtHeaderType != 10 %}
  201.         {# ThemeWare: Add sticky data attribute #}
  202.         {% if twtStickyNavMainShow > 1 %}
  203.             {# ThemeWare: Set data only if sticky navigation is activated #}
  204.             <div class="nav-main">
  205.                 {% block base_navigation_inner %}
  206.                     <div class="container">
  207.                         {# ThemeWare: Add sticky logo for sticky-navigation #}
  208.                         {% if twtStickyNavMainLogoShow == 2 and twtStickyNavMainLogoImage %}
  209.                             {% block layout_sticky_logo %}
  210.                                 <div id="sticky-logo" class="d-none">
  211.                                     <a class="sticky-logo-main-link" href="{{ path('frontend.home.page') }}" title="{{ "header.logoLink"|trans|striptags }}">
  212.                                         <picture>
  213.                                             {# Default logo #}
  214.                                             {% if twtHeaderLogoType != 2 %}
  215.                                                 <img src="{{ twtStickyNavMainLogoImage |sw_encode_url }}" alt="{{ "header.logoLink"|trans|striptags }}" />
  216.                                             {% endif %}
  217.                                             {# ThemeWare: "Text-Logo" ergänzen. #}
  218.                                             {% block twt_layout_header_textlogo %}
  219.                                                 {% if twtHeaderLogoType == 2 %}
  220.                                                     {% sw_include '@Storefront/storefront/themeware/includes/twt-textlogo-include.html.twig' ignore missing with {
  221.                                                         sticky: true
  222.                                                     } %}
  223.                                                 {% endif %}
  224.                                             {% endblock %}
  225.                                         </picture>
  226.                                     </a>
  227.                                 </div>
  228.                             {% endblock %}
  229.                         {% endif %}
  230.                         {# ThemeWare: Add nav-main-toggle for sticky-navigation #}
  231.                         {% if twtStickyNavMainToggle == 2 or twtStickyNavMainShow == 3 %}
  232.                             {% block layout_sticky_navigation_toggle %}
  233.                                 <div id="sticky-nav-main-toggle" class="d-none">
  234.                                     <div class="menu-button">
  235.                                         <button class="btn nav-main-toggle-btn header-actions-btn"    type="button" title="{{ "twt.header.offcanvasMenuText"|trans }}" data-offcanvas-menu="true" aria-label="{{ "general.menuLink"|trans|striptags }}">
  236.                                         {% sw_icon 'stack' %}
  237.                                         {# ThemeWare: Add label 'Navigation' to toggle-icon #}
  238.                                         <span class="header-nav-main-toggle-label">
  239.                                             {{ "twt.header.offcanvasMenuText"|trans }}
  240.                                         </span>
  241.                                         </button>
  242.                                     </div>
  243.                                 </div>
  244.                             {% endblock %}
  245.                         {% endif %}
  246.                         {# ThemeWare: Add cart-button for sticky-navigation #}
  247.                         {% if twtStickyNavMainCartShow == 2 %}
  248.                             <span id="js-sticky-cart-position" class="d-none"></span>
  249.                         {% endif %}
  250.                         {# ThemeWare: Add search-button for sticky-navigation #}
  251.                         {% if twtStickyNavMainSearchShow == 2 %}
  252.                             <span id="js-sticky-search-position" class="d-none"></span>
  253.                         {% endif %}
  254.                     </div>
  255.                     {# Default block #}
  256.                     {{ parent() }}
  257.                 {% endblock %}
  258.             </div>
  259.         {% else %}
  260.             {# Default block #}
  261.             {{ parent() }}
  262.         {% endif %}
  263.     {% endif %}
  264.     {# ThemeWare: Add elements after the main navigation #}
  265.     {# ThemeWare: New position for the search container with "Flyout search" (twt-header-search-type 2) or "Fullscreen search" (twt-header-search-type 4)
  266.         - "Flyout search" must be used in "Header 2.1" (twt-header-type 4)
  267.     #}
  268.     {% if twtHeaderSearchType == 2 or twtHeaderSearchType == 4 %}
  269.         {% block twt_layout_header_search_on_header %}
  270.             <div class="search-container">
  271.                 {% sw_include '@Storefront/storefront/layout/header/search.html.twig' %}
  272.             </div>
  273.         {% endblock %}
  274.     {% endif %}
  275.     {# ThemeWare: "USP-Bar" unter dem Header hinzufügen. #}
  276.     {% if twtUspBarHeader > 1 and twtUspBarHeaderPosition == 3 %}
  277.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  278.             type: 'header',
  279.             alignment: 'top'
  280.         } %}
  281.     {% endif %}
  282. {% endblock %}
  283. {# ThemeWare: Adjustments on script block #}
  284. {# TODO: Check with v6.5.0 #}
  285. {% block base_body_script %}
  286.     {# ThemeWare: Add data atrributes (for ThemeWare exclusive elements) #}
  287.     <div id="twt-data-attributes" class="invisible d-none"
  288.          {% if twtShoppingExperiencesHeader %} {# "Erlebniswelt-Header" aktiv #}
  289.              data-twt-shopping-experiences-header="true"
  290.          {% endif %}
  291.          {% if twtStickyNavMainShow > 1 and twtHeaderType < 10 %} {# Top-Navigation ist sticky (nicht im Custom-Header) #}
  292.              data-twt-sticky-breakpoint="{{ twtStickyNavMainBreakpoint }}"
  293.              data-twt-sticky-cart="{{ twtStickyNavMainCartShow }}"
  294.              data-twt-sticky-container-width="{{ twtContainerMaxWidth }}"
  295.              data-twt-sticky-scroll-top="{{ twtStickyNavMainScrollTop }}"
  296.              data-twt-sticky-search="{{ twtStickyNavMainSearchShow }}"
  297.              data-twt-sticky-type="{{ twtStickyNavMainType }}"
  298.          {% endif %}
  299.          {% if twtStickyNavMainShow > 1 and twtHeaderType < 10 %} {# Mobile Header ist sticky (nicht im Custom-Header) #}
  300.              data-twt-mobile-sticky-header="{{ twtHeaderPhoneFixed }}"
  301.          {% endif %}
  302.          data-twt-search-type="{{ twtHeaderSearchType }}"
  303.     ></div>
  304.     {# Default block #}
  305.     {{ parent() }}
  306.     {# ThemeWare: JavaScript ergänzen. #}
  307.     {% if twtCustomJsCode and twtExpertMode == 2 %}
  308.         <!-- Custom js code -->
  309.         {{ theme_config('twt-custom-js-code') | raw }}
  310.     {% endif %}
  311.     {# ThemeWare: JS-Datei ergänzen. #}
  312.     {% if twtAdditionalJsFile and twtAdditionalJsFileLoad == 2 and twtExpertMode == 2 %}
  313.         <!-- Custom js file -->
  314.         <script type="text/javascript" src="{{ twtAdditionalJsFile }}" crossorigin="anonymous"{% if twtAdditionalJsFileAsync == 2 %} async{% endif %}></script>
  315.     {% endif %}
  316. {% endblock %}