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