custom/plugins/zenitPlatformHorizon/src/Resources/views/storefront/layout/meta.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}
  2. {% block layout_head_stylesheet %}
  3.     {{ parent() }}
  4.     {% block zen_layout_head_styles %}
  5.         {% if theme_config('zen-layout-bg-img') %}
  6.             <style data-plugin="zenitHorizon">{% apply spaceless %}
  7.                 body {
  8.                     background-image: url("{{ theme_config('zen-layout-bg-img') }}");
  9.                 }
  10.             {% endapply %}</style>
  11.         {% endif %}
  12.     {% endblock %}
  13.     {% block zen_layout_head_custom_css_files %}
  14.         {% if config('zenitPlatformHorizon.config.customCssFilesActive') %}
  15.             {{ config('zenitPlatformHorizon.config.customCssFiles')|raw }}
  16.         {% endif %}
  17.     {% endblock %}
  18.     {% block zen_layout_head_custom_css_styles %}
  19.         {% if config('zenitPlatformHorizon.config.customCssActive') %}
  20.             <style data-plugin="zenitHorizonCustomCss">{% apply spaceless %}
  21.                 {{ config('zenitPlatformHorizon.config.customCss')|replace({'<style>': '','</style>': ''})|raw }}
  22.                 {% endapply %}</style>
  23.         {% endif %}
  24.     {% endblock %}
  25. {% endblock %}
  26. {% block layout_head_javascript_tracking %}
  27.     {{ parent() }}
  28.     {% block zen_layout_head_theme_js_files %}
  29.         {% if config('zenitPlatformHorizon.config.customHeadJsFilesActive') %}
  30.             {{ config('zenitPlatformHorizon.config.customHeadJsFiles')|raw }}
  31.         {% endif %}
  32.     {% endblock %}
  33.     {% block zen_layout_head_theme_js_custom %}
  34.         {% if config('zenitPlatformHorizon.config.customHeadJsActive') %}
  35.             <script data-plugin="zenitHorizonCustomHeadJs">
  36.                 {{ config('zenitPlatformHorizon.config.customHeadJs')|replace({'<script>': '','</script>': ''})|raw }}
  37.             </script>
  38.         {% endif %}
  39.     {% endblock %}
  40.     {% block zen_base_webfont %}
  41.         {# Fonts implementation checks if has custom fonts to load #}
  42.         {% set hasCustomBaseFont = theme_config('zen-font-family-base-default') is null or theme_config('zen-font-family-base-default') is same as ('custom') %}
  43.         {% set hasCustomHeadlineFont = theme_config('zen-font-family-headline-default') is null or theme_config('zen-font-family-headline-default') is same as ('custom') %}
  44.         {% if theme_config('sw-font-family-base') and hasCustomBaseFont %}
  45.             {% set fontFamilyBase = theme_config('sw-font-family-base')|replace({'\'':'', ' ':'+'})|split(',')[0] ~ ':' ~ theme_config('zen-font-family-base-weight')|join(',') %}
  46.         {% endif %}
  47.         {% if theme_config('sw-font-family-headline') and hasCustomHeadlineFont %}
  48.             {% set fontFamilyHeadline = theme_config('sw-font-family-headline')|replace({'\'':'', ' ':'+'})|split(',')[0] ~ ':' ~ theme_config('zen-font-family-headline-weight')|join(',') %}
  49.         {% endif %}
  50.         {# Avoid double implementation when base and headline fonts are the same #}
  51.         {% if theme_config('sw-font-family-base') is same as (theme_config('sw-font-family-headline')) %}
  52.             {% if hasCustomBaseFont %}
  53.                 {% set fontFamilyHeadline = '' %}
  54.             {% elseif hasCustomHeadlineFont %}
  55.                 {% set fontFamilyBase = '' %}
  56.             {% endif %}
  57.             {% for weight in theme_config('zen-font-family-headline-weight') %}
  58.                 {% if weight not in theme_config('zen-font-family-base-weight') %}
  59.                     {% set fontFamilyBase = fontFamilyBase ~ ',' ~ weight %}
  60.                 {% endif %}
  61.             {% endfor %}
  62.         {% endif %}
  63.         {# Google Webfont Loader #}
  64.         {% block zen_base_webfont_loader %}
  65.             {% if theme_config('zen-font-family-import') and (hasCustomBaseFont or hasCustomHeadlineFont) %}
  66.                 {# ... @zenit - check if it is app environment or not #}
  67.                 {% if context.context.extensions['zenitPlatformHorizon'].system is not defined %}
  68.                     {% set loader = asset('bundles/zenitplatformhorizon/assets/font/webfont.js') %}
  69.                 {% else %}
  70.                     {% set loader = asset('bundles/zenitplatformhorizon/storefront/assets/font/webfont.js') %}
  71.                 {% endif %}
  72.                 {# ... @zenit - theme script options #}
  73.                 {% set googleFontsOptions = {
  74.                     checkCookie: config('zenitPlatformHorizon.config.googleFontsCookie'),
  75.                     webfontLoaderUrl: loader,
  76.                     zenthemeFontFamilyBase: fontFamilyBase,
  77.                     zenthemeFontFamilyHeadline: fontFamilyHeadline
  78.                 } %}
  79.                 {% if config('zenitPlatformHorizon.config.googleFontsCookie') %}
  80.                     <template data-zen-google-fonts="true" data-zen-google-fonts-options="{{ googleFontsOptions|json_encode }}"></template>
  81.                 {% else %}
  82.                     <script data-plugin="zenitHorizonFonts">
  83.                         var zenthemeFonts = [],
  84.                             zenthemeFontFamilyBase = '{{ fontFamilyBase }}',
  85.                             zenthemeFontFamilyHeadline = '{{ fontFamilyHeadline }}';
  86.                         fontDisplay = '&display=swap';
  87.                         zenthemeFontFamilyBase ? zenthemeFonts.push( zenthemeFontFamilyBase.replace('&amp;','&') ) : '';
  88.                         zenthemeFontFamilyHeadline ? zenthemeFonts.push( zenthemeFontFamilyHeadline.replace('&amp;','&') ) : '';
  89.                         zenthemeFonts.push( fontDisplay.replace('&amp;','&') );
  90.                         WebFontConfig = {
  91.                             google: {
  92.                                 families: zenthemeFonts,
  93.                                 timeout: 2000,
  94.                             },
  95.                             active: function () {
  96.                                 let event = new Event('webfontsloaded');
  97.                                 document.dispatchEvent(event);
  98.                             },
  99.                         };
  100.                         (function(d) {
  101.                             const wf = d.createElement('script'), s = d.scripts[0];
  102.                             wf.src = '{{ loader }}';
  103.                             wf.async = true;
  104.                             s.parentNode.insertBefore(wf, s);
  105.                         })(document);
  106.                     </script>
  107.                 {% endif %}
  108.             {% endif %}
  109.         {% endblock %}
  110.     {% endblock %}
  111. {% endblock %}
  112. {% block layout_head_apple %}
  113.     {{ parent() }}
  114.     <meta name="theme-color" content="{{ theme_config('zen-meta-theme-color') }}"/>
  115. {% endblock %}