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