custom/plugins/TcinnThemeWareStrong/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('TcinnThemeWareStrong.config.debugMode') is not empty and config('TcinnThemeWareStrong.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_strong_pro_custom_field__category__shopping_experiences_header is not empty and twtCustomFields.category.twt_strong_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_strong_pro_custom_field__category__body_class is not empty %}
  112.         {% set bodyClasses = [twtCustomFields.category.twt_strong_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-strong']|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.         } %}
  165.     {% endif %}
  166.     {# ThemeWare: "USP-Bar" über dem Header ergänzen. #}
  167.     {% if twtUspBarHeader > 1 and twtUspBarHeaderPosition == 1 %}
  168.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  169.             type: 'header',
  170.             alignment: 'top'
  171.         } %}
  172.     {% endif %}
  173.     {# Default block #}
  174.     {{ parent() }}
  175.     {# ThemeWare: "USP-Bar" über der Navigation ergänzen. #}
  176.     {% if twtUspBarHeader > 1 and twtUspBarHeaderPosition == 2 %}
  177.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  178.             type: 'header'
  179.         } %}
  180.     {% endif %}
  181. {% endblock %}
  182. {# ThemeWare: Adjustments on base footer #}
  183. {% block base_footer %}
  184.     {# ThemeWare: "USP-Bar" über dem Footer ergänzen. #}
  185.     {% if twtUspBarFooter > 1 and twtUspBarFooterPosition == 1 %}
  186.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  187.             type: 'footer'
  188.         } %}
  189.     {% endif %}
  190.     {# Default block #}
  191.     {{ parent() }}
  192.     {# ThemeWare: "Slideout-Communities" zum Footer hinzufügen. #}
  193.     {# TODO: Add configuration #}
  194.     {% if twtSlideoutCommunitiesShow == 2 %}
  195.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-slideout-communities.html.twig' ignore missing %}
  196.     {% endif %}
  197.     {# ThemeWare: "Floating-Widget" zum Footer hinzufügen. #}
  198.     {% if twtFloatingWidgetShow == 2 %}
  199.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-floating-widget.html.twig' ignore missing with {
  200.             open: twtFloatingWidgetShowOpened,
  201.             animation: twtFloatingWidgetAnimation,
  202.             backdrop: twtFloatingWidgetBackdrop
  203.         } %}
  204.     {% endif %}
  205. {% endblock %}
  206. {# ThemeWare: Adjustments on the main navigation #}
  207. {# TODO: Check compatibility #}
  208. {% block base_navigation %}
  209.     {# ThemeWare: Block leeren wenn "Header 10" aktiv ist. Andernfalls werden Anpassungen für unsere Basis-Header vorgenommen.   #customHeader #}
  210.     {% if twtHeaderType != 10 %}
  211.         {# ThemeWare: Add sticky data attribute #}
  212.         {% if twtStickyNavMainShow > 1 %}
  213.             {# ThemeWare: Set data only if sticky navigation is activated #}
  214.             <div class="nav-main">
  215.                 {% block base_navigation_inner %}
  216.                     <div class="container">
  217.                         {# ThemeWare: Add sticky logo for sticky-navigation #}
  218.                         {% if twtStickyNavMainLogoShow == 2 and twtStickyNavMainLogoImage %}
  219.                             {% block layout_sticky_logo %}
  220.                                 <div id="sticky-logo" class="d-none">
  221.                                     <a class="sticky-logo-main-link" href="{{ path('frontend.home.page') }}" title="{{ "header.logoLink"|trans|striptags }}">
  222.                                         <picture>
  223.                                             {# Default logo #}
  224.                                             {% if twtHeaderLogoType != 2 %}
  225.                                                 <img src="{{ twtStickyNavMainLogoImage |sw_encode_url }}" alt="{{ "header.logoLink"|trans|striptags }}" />
  226.                                             {% endif %}
  227.                                             {# ThemeWare: "Text-Logo" ergänzen. #}
  228.                                             {% block twt_layout_header_textlogo %}
  229.                                                 {% if twtHeaderLogoType == 2 %}
  230.                                                     {% sw_include '@Storefront/storefront/themeware/includes/twt-textlogo-include.html.twig' ignore missing with {
  231.                                                         sticky: true
  232.                                                     } %}
  233.                                                 {% endif %}
  234.                                             {% endblock %}
  235.                                         </picture>
  236.                                     </a>
  237.                                 </div>
  238.                             {% endblock %}
  239.                         {% endif %}
  240.                         {# ThemeWare: Add nav-main-toggle for sticky-navigation #}
  241.                         {% if twtStickyNavMainToggle == 2 or twtStickyNavMainShow == 3 %}
  242.                             {% block layout_sticky_navigation_toggle %}
  243.                                 <div id="sticky-nav-main-toggle" class="d-none">
  244.                                     <div class="menu-button">
  245.                                         <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 }}">
  246.                                             {% if twtIconSet is not same as ('default') %}
  247.                                                 {% sw_icon 'stack' style {'pack':'themeware'} %}
  248.                                             {% else %}
  249.                                                 {% sw_icon 'stack' %}
  250.                                             {% endif %}
  251.                                             {# ThemeWare: Add label 'Navigation' to toggle-icon #}
  252.                                             <span class="header-nav-main-toggle-label">
  253.                                                 {{ "twt.header.offcanvasMenuText"|trans }}
  254.                                             </span>
  255.                                         </button>
  256.                                     </div>
  257.                                 </div>
  258.                             {% endblock %}
  259.                         {% endif %}
  260.                         {# ThemeWare: Add cart-button for sticky-navigation #}
  261.                         {% if twtStickyNavMainCartShow == 2 %}
  262.                             <span id="js-sticky-cart-position" class="d-none"></span>
  263.                         {% endif %}
  264.                         {# ThemeWare: Add search-button for sticky-navigation #}
  265.                         {% if twtStickyNavMainSearchShow == 2 %}
  266.                             <span id="js-sticky-search-position" class="d-none"></span>
  267.                         {% endif %}
  268.                     </div>
  269.                     {# Default block #}
  270.                     {{ parent() }}
  271.                 {% endblock %}
  272.             </div>
  273.         {% else %}
  274.             {# Default block #}
  275.             {{ parent() }}
  276.         {% endif %}
  277.     {% endif %}
  278.     {# ThemeWare: Add elements after the main navigation #}
  279.     {# ThemeWare: New position for the search container with "Flyout search" (twt-header-search-type 2) or "Fullscreen search" (twt-header-search-type 4)
  280.         - "Flyout search" must be used in "Header 2.1" (twt-header-type 4)
  281.     #}
  282.     {% if twtHeaderSearchType == 2 or twtHeaderSearchType == 4 %}
  283.         {% block twt_layout_header_search_on_header %}
  284.             <div class="search-container">
  285.                 {% sw_include '@Storefront/storefront/layout/header/search.html.twig' %}
  286.             </div>
  287.         {% endblock %}
  288.     {% endif %}
  289.     {# ThemeWare: "USP-Bar" unter dem Header hinzufügen. #}
  290.     {% if twtUspBarHeader > 1 and twtUspBarHeaderPosition == 3 %}
  291.         {% sw_include '@Storefront/storefront/themeware/extensions/twt-usp-bar.html.twig' ignore missing with {
  292.             type: 'header',
  293.             alignment: 'top'
  294.         } %}
  295.     {% endif %}
  296. {% endblock %}
  297. {# ThemeWare: Adjustments on script block #}
  298. {# TODO: Check with v6.5.0 #}
  299. {% block base_body_script %}
  300.     {# ThemeWare: Add data atrributes (for ThemeWare exclusive elements) #}
  301.     <div id="twt-data-attributes" class="invisible d-none"
  302.          {% if twtShoppingExperiencesHeader %} {# "Erlebniswelt-Header" aktiv #}
  303.              data-twt-shopping-experiences-header="true"
  304.          {% endif %}
  305.          {% if twtStickyNavMainShow > 1 and twtHeaderType < 10 %} {# Top-Navigation ist sticky (nicht im Custom-Header) #}
  306.              data-twt-sticky-breakpoint="{{ twtStickyNavMainBreakpoint }}"
  307.              data-twt-sticky-cart="{{ twtStickyNavMainCartShow }}"
  308.              data-twt-sticky-container-width="{{ twtContainerMaxWidth }}"
  309.              data-twt-sticky-scroll-top="{{ twtStickyNavMainScrollTop }}"
  310.              data-twt-sticky-search="{{ twtStickyNavMainSearchShow }}"
  311.              data-twt-sticky-type="{{ twtStickyNavMainType }}"
  312.          {% endif %}
  313.          {% if twtStickyNavMainShow > 1 and twtHeaderType < 10 %} {# Mobile Header ist sticky (nicht im Custom-Header) #}
  314.              data-twt-mobile-sticky-header="{{ twtHeaderPhoneFixed }}"
  315.          {% endif %}
  316.         {% if twtCookiePermissionPosition > 1 %} {# Cookie permission position #}
  317.             data-twt-cookie-permission-position="true"
  318.         {% endif %}
  319.          data-twt-search-type="{{ twtHeaderSearchType }}"
  320.          data-twt-top-navigation-type="{{ twtNavMainShow }}"
  321.     ></div>
  322.     {# ThemeWare: Debug mode #}
  323.     {% if config('TcinnThemeWareStrong.config.debugMode') is not empty and config('TcinnThemeWareStrong.config.debugMode') == 'true' %}
  324.         <!-- BEGIN: Debug information -->
  325.         <!-- Theme: Strong -->
  326.         <!-- Edition: Pro -->
  327.         <!-- Version: 1.1.11 -->
  328.         <!-- CMS page type: {% if page.cmsPage.type != NULL %}{{ page.cmsPage.type }}{% else %}none{% endif %} -->
  329.         <!-- Expert mode: {% if twtExpertMode == 1 %}false{% else %}true{% endif %} -->
  330.         <!-- Individual CSS code: {% if twtCustomCssCode is empty %}false{% else %}true{% endif %} -->
  331.         <!-- Individual HTML code: {% if twtCustomHtmlCode is empty %}false{% else %}true{% endif %} -->
  332.         <!-- Individual JavaScript code: {% if twtCustomJsCode is empty %}false{% else %}true{% endif %} -->
  333.         <!-- Load CSS file: {% if twtAdditionalCssFileLoad == 1 %}false{% else %}true{% endif %} -->
  334.         <!-- Load JavaScript file: {% if twtAdditionalJsFileLoad == 1 %}false{% else %}true{% endif %} -->
  335.         <!-- END: Debug information -->
  336.     {% endif %}
  337.     {# ThemeWare: Add copyright informations #}
  338.     {% if twtIconSet == 'fa-free' or twtIconSet == 'fa-free-alt' %}
  339.         <!--! Font Awesome Free 5 by @fontawesome - https://fontawesome.com | License - https://fontawesome.com/license/free -->
  340.     {% endif %}
  341.     {% if twtIconSet == 'fa6-free' or twtIconSet == 'fa6-free-alt' %}
  342.         <!--! Font Awesome Free 6 by @fontawesome - https://fontawesome.com | License - https://fontawesome.com/license/free Copyright 2022 Fonticons, Inc. -->
  343.     {% endif %}
  344.     {# Default block #}
  345.     {{ parent() }}
  346.     {# ThemeWare: JavaScript ergänzen. #}
  347.     {% if twtCustomJsCode and twtExpertMode == 2 %}
  348.         <!-- Custom js code -->
  349.         {{ theme_config('twt-custom-js-code') | raw }}
  350.     {% endif %}
  351.     {# ThemeWare: JS-Datei ergänzen. #}
  352.     {% if twtAdditionalJsFile and twtAdditionalJsFileLoad == 2 and twtExpertMode == 2 %}
  353.         <!-- Custom js file -->
  354.         <script type="text/javascript" src="{{ twtAdditionalJsFile }}" crossorigin="anonymous"{% if twtAdditionalJsFileAsync == 2 %} async{% endif %}></script>
  355.     {% endif %}
  356. {% endblock %}