custom/plugins/zenitPlatformHorizon/src/Resources/views/storefront/page/content/detail.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/content/detail.html.twig' %}
  2. {% block page_content_sections_inner %}
  3.     <div class="cms-sections">
  4.         {% for section in cmsPage.sections %}
  5.             {% set sectionClasses = [section.cssClass, 'pos-' ~ section.position, 'cms-section-' ~ section.type] %}
  6.             {% if section.visibility is null %}
  7.                 {% set visibility = {
  8.                     mobile: true,
  9.                     tablet: true,
  10.                     desktop: true
  11.                 } %}
  12.             {% else %}
  13.                 {% set visibility = section.visibility %}
  14.             {% endif %}
  15.             {% if not visibility.mobile %}
  16.                 {% set sectionClasses = ['hidden-mobile']|merge(sectionClasses) %}
  17.             {% endif %}
  18.             {% if not visibility.tablet %}
  19.                 {% set sectionClasses = ['hidden-tablet']|merge(sectionClasses) %}
  20.             {% endif %}
  21.             {% if not visibility.desktop %}
  22.                 {% set sectionClasses = ['hidden-desktop']|merge(sectionClasses) %}
  23.             {% endif %}
  24.             {% if loop.index is same as (1) and isHeroSection is same as (true) %}
  25.                 {# ... @zenit - section classes #}
  26.                 {% set sectionClasses = ['cms-section-hero']|merge(sectionClasses) %}
  27.                 {# ... @zenit - set section bg color #}
  28.                 {% if zenCustomFields.category.zenit_horizon_category_image_color is empty %}
  29.                     {% set sectionBgColor = section.backgroundColor ? section.backgroundColor : 'transparent' %}
  30.                 {% else %}
  31.                     {% set sectionBgColor = zenCustomFields.category.zenit_horizon_category_image_color %}
  32.                 {% endif %}
  33.                 {# ... @zenit - set section bg image #}
  34.                 {% set sectionBgImg = section.backgroundMedia|sw_encode_media_url %}
  35.                 {# ... @zenit - category image #}
  36.                 {% set categoryMedia = page.header.navigation.active.media %}
  37.                 {% if hasCategoryImage %}
  38.                     {% if categoryMedia %}
  39.                         {# ... @zenit - category image style #}
  40.                         {% set sectionBgImg = categoryMedia|sw_encode_media_url %}
  41.                         {# ... @zenit - category image class #}
  42.                         {% set sectionClasses = ['category-image']|merge(sectionClasses) %}
  43.                     {% elseif sectionBgImg %}
  44.                         {# ... @zenit - category image class #}
  45.                         {% set sectionClasses = ['category-image']|merge(sectionClasses) %}
  46.                     {% endif %}
  47.                 {% endif %}
  48.                 {# ... @zenit - category overlay class #}
  49.                 {% if sectionCategoryOverlay %}
  50.                     {% set sectionClasses = ['cms-section-overlay']|merge(sectionClasses) %}
  51.                 {% endif %}
  52.                 {# ... @zenit - set section bg image mode #}
  53.                 {% if section.backgroundMediaMode %}
  54.                     {% set sectionBgImgMode = section.backgroundMediaMode %}
  55.                 {% else %}
  56.                     {% set sectionBgImgMode = 'cover' %}
  57.                 {% endif %}
  58.                 {# ... @zenit - set opacity style #}
  59.                 {% set categoryImageOpacity = zenCustomFields.category.zenit_horizon_category_image_opacity|replace({'%': ''}) %}
  60.                 {% if categoryImageOpacity is empty or categoryImageOpacity is same as ('inherit') %}
  61.                     {% set sectionBgOpacity = theme_config("zen-category-image-opacity")|number_format %}
  62.                 {% else %}
  63.                     {% set sectionBgOpacity = categoryImageOpacity|number_format %}
  64.                 {% endif %}
  65.                 {# ... @zenit - set attachment style #}
  66.                 {% if zenCustomFields.category.zenit_horizon_category_image_attachment is empty or zenCustomFields.category.zenit_horizon_category_image_attachment is same as ('inherit') %}
  67.                     {% set sectionBgAttachment = theme_config("zen-category-image-attachment") %}
  68.                 {% else %}
  69.                     {% set sectionBgAttachment = zenCustomFields.category.zenit_horizon_category_image_attachment %}
  70.                 {% endif %}
  71.                 {# ... @zenit - set position style #}
  72.                 {% if zenCustomFields.category.zenit_horizon_category_image_position is empty or zenCustomFields.category.zenit_horizon_category_image_position is same as ('inherit') %}
  73.                     {% set sectionBgPosition = theme_config("zen-category-image-position") %}
  74.                 {% else %}
  75.                     {% set sectionBgPosition = zenCustomFields.category.zenit_horizon_category_image_position %}
  76.                 {% endif %}
  77.                 {# ... @zenit - bg image class #}
  78.                 {% if sectionBgImg %}
  79.                     {% set sectionClasses = ['bg-image']|merge(sectionClasses) %}
  80.                 {% endif %}
  81.                 {# ... @zenit - bg color class #}
  82.                 {% if sectionBgColor %}
  83.                     {% set sectionClasses = ['bg-color']|merge(sectionClasses) %}
  84.                 {% endif %}
  85.                 {# ... @zenit - contrast class #}
  86.                 {% if zenCustomFields.category.zenit_horizon_category_image_contrast is empty or zenCustomFields.category.zenit_horizon_category_image_contrast is same as ('inherit') %}
  87.                     {% set sectionClasses = [theme_config("zen-category-image-contrast")]|merge(sectionClasses) %}
  88.                 {% else %}
  89.                     {% set sectionClasses = [zenCustomFields.category.zenit_horizon_category_image_contrast]|merge(sectionClasses) %}
  90.                 {% endif %}
  91.                 {# ... @zenit - opacity class #}
  92.                 {% if sectionBgOpacity < 100 and sectionBgColor %}
  93.                     {% set sectionClasses = ['has-opacity']|merge(sectionClasses) %}
  94.                 {% endif %}
  95.                 {% set layout = section.sizingMode ? section.sizingMode|replace({"_": "-"}) : "container" %}
  96.                 {% block zen_page_content_section_category_image %}
  97.                     <div class="cms-section {{ layout }} {{ sectionClasses|join(' ') }}"
  98.                          style="{% if sectionBgAttachment %}background-attachment: {{ sectionBgAttachment }};{% endif %}{% if sectionBgPosition %}background-position: {{ sectionBgPosition }};{% endif %}{% if sectionBgColor %}background-color: {{ sectionBgColor }};{% endif %}{% if sectionBgImg %}background-image: url('{{ sectionBgImg }}');background-size: {{ sectionBgImgMode }};{% endif %}">
  99.                         {% if sectionBgOpacity < 100 and sectionBgColor %}
  100.                             <div class="cms-section-bg-color-overlay"
  101.                                  style="background-color: {{ sectionBgColor }}; opacity: {{(100 - sectionBgOpacity|number_format) / 100 }};">
  102.                             </div>
  103.                         {% endif %}
  104.                         {% sw_include "@Storefront/storefront/section/cms-section-" ~ section.type ~ ".html.twig" %}
  105.                     </div>
  106.                 {% endblock %}
  107.                 {# ... @zenit - add default breadcrumbs, after first sections if it's an hero section  #}
  108.                 {% if defaultBreadcrumbs %}
  109.                     {# ... @zenit - check if there is any breadcrumb to show #}
  110.                     {% if sw_breadcrumb_full(page.header.navigation.active, context.context) %}
  111.                         <div class="breadcrumb-container">
  112.                             <div class="container">
  113.                                 <div class="breadcrumb-wrap cms-breadcrumb justify-content-{{ theme_config('zen-breadcrumbs-align')|replace({'flex-': ''}) }}">
  114.                                     {% block cms_breadcrumb %}
  115.                                         {% sw_include '@Storefront/storefront/layout/breadcrumb.html.twig' with {
  116.                                             navigationTree: page.header.navigation.tree,
  117.                                             category: page.header.navigation.active
  118.                                         } only %}
  119.                                     {% endblock %}
  120.                                 </div>
  121.                             </div>
  122.                         </div>
  123.                     {% endif %}
  124.                 {% endif %}
  125.             {% else %}
  126.                 {% set sectionBgColor = section.backgroundColor %}
  127.                 {% set sectionBgImg = section.backgroundMedia|sw_encode_media_url %}
  128.                 {% set sectionBgImgMode = section.backgroundMediaMode %}
  129.                 {% if sectionBgImg %}
  130.                     {% set sectionClasses = ['bg-image']|merge(sectionClasses) %}
  131.                 {% endif %}
  132.                 {% if sectionBgColor %}
  133.                     {% set sectionClasses = ['bg-color']|merge(sectionClasses) %}
  134.                 {% endif %}
  135.                 {# ... @zenit - category overlay class #}
  136.                 {% if loop.index is same as (1) and sectionCategoryOverlay is same as (true) %}
  137.                     {% if sectionCategoryOverlay %}
  138.                         {% set sectionClasses = ['cms-section-overlay']|merge(sectionClasses) %}
  139.                     {% endif %}
  140.                 {% endif %}
  141.                 {% set layout = section.sizingMode ? section.sizingMode|replace({"_": "-"}) : "container" %}
  142.                 {% block page_content_section %}
  143.                     <div class="cms-section {{ layout }} {{ sectionClasses|join(' ') }}"
  144.                          style="{% if sectionBgColor %}background-color: {{ sectionBgColor }};{% endif %}{% if sectionBgImg %}background-image: url('{{ sectionBgImg }}');background-size: {{ section.backgroundMediaMode }};{% endif %}">
  145.                         {% sw_include "@Storefront/storefront/section/cms-section-" ~ section.type ~ ".html.twig" %}
  146.                     </div>
  147.                 {% endblock %}
  148.             {% endif %}
  149.         {% endfor %}
  150.     </div>
  151. {% endblock %}