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