{% sw_extends '@Storefront/storefront/page/content/detail.html.twig' %}
{% block page_content_sections_inner %}
<div class="cms-sections">
{% for section in cmsPage.sections %}
{% set sectionClasses = [section.cssClass, 'pos-' ~ section.position, 'cms-section-' ~ section.type] %}
{% if section.visibility is null %}
{% set visibility = {
mobile: true,
tablet: true,
desktop: true
} %}
{% else %}
{% set visibility = section.visibility %}
{% endif %}
{% if not visibility.mobile %}
{% set sectionClasses = ['hidden-mobile']|merge(sectionClasses) %}
{% endif %}
{% if not visibility.tablet %}
{% set sectionClasses = ['hidden-tablet']|merge(sectionClasses) %}
{% endif %}
{% if not visibility.desktop %}
{% set sectionClasses = ['hidden-desktop']|merge(sectionClasses) %}
{% endif %}
{% if loop.index is same as (1) and isHeroSection is same as (true) %}
{# ... @zenit - section classes #}
{% set sectionClasses = ['cms-section-hero']|merge(sectionClasses) %}
{# ... @zenit - set section bg color #}
{% if zenCustomFields.category.zenit_horizon_category_image_color is empty %}
{% set sectionBgColor = section.backgroundColor ? section.backgroundColor : 'transparent' %}
{% else %}
{% set sectionBgColor = zenCustomFields.category.zenit_horizon_category_image_color %}
{% endif %}
{# ... @zenit - set section bg image #}
{% set sectionBgImg = section.backgroundMedia|sw_encode_media_url %}
{# ... @zenit - category image #}
{% set categoryMedia = page.header.navigation.active.media %}
{% if hasCategoryImage %}
{% if categoryMedia %}
{# ... @zenit - category image style #}
{% set sectionBgImg = categoryMedia|sw_encode_media_url %}
{# ... @zenit - category image class #}
{% set sectionClasses = ['category-image']|merge(sectionClasses) %}
{% elseif sectionBgImg %}
{# ... @zenit - category image class #}
{% set sectionClasses = ['category-image']|merge(sectionClasses) %}
{% endif %}
{% endif %}
{# ... @zenit - category overlay class #}
{% if sectionCategoryOverlay %}
{% set sectionClasses = ['cms-section-overlay']|merge(sectionClasses) %}
{% endif %}
{# ... @zenit - set section bg image mode #}
{% if section.backgroundMediaMode %}
{% set sectionBgImgMode = section.backgroundMediaMode %}
{% else %}
{% set sectionBgImgMode = 'cover' %}
{% endif %}
{# ... @zenit - set opacity style #}
{% set categoryImageOpacity = zenCustomFields.category.zenit_horizon_category_image_opacity|replace({'%': ''}) %}
{% if categoryImageOpacity is empty or categoryImageOpacity is same as ('inherit') %}
{% set sectionBgOpacity = theme_config("zen-category-image-opacity")|number_format %}
{% else %}
{% set sectionBgOpacity = categoryImageOpacity|number_format %}
{% endif %}
{# ... @zenit - set attachment style #}
{% if zenCustomFields.category.zenit_horizon_category_image_attachment is empty or zenCustomFields.category.zenit_horizon_category_image_attachment is same as ('inherit') %}
{% set sectionBgAttachment = theme_config("zen-category-image-attachment") %}
{% else %}
{% set sectionBgAttachment = zenCustomFields.category.zenit_horizon_category_image_attachment %}
{% endif %}
{# ... @zenit - set position style #}
{% if zenCustomFields.category.zenit_horizon_category_image_position is empty or zenCustomFields.category.zenit_horizon_category_image_position is same as ('inherit') %}
{% set sectionBgPosition = theme_config("zen-category-image-position") %}
{% else %}
{% set sectionBgPosition = zenCustomFields.category.zenit_horizon_category_image_position %}
{% endif %}
{# ... @zenit - bg image class #}
{% if sectionBgImg %}
{% set sectionClasses = ['bg-image']|merge(sectionClasses) %}
{% endif %}
{# ... @zenit - bg color class #}
{% if sectionBgColor %}
{% set sectionClasses = ['bg-color']|merge(sectionClasses) %}
{% endif %}
{# ... @zenit - contrast class #}
{% if zenCustomFields.category.zenit_horizon_category_image_contrast is empty or zenCustomFields.category.zenit_horizon_category_image_contrast is same as ('inherit') %}
{% set sectionClasses = [theme_config("zen-category-image-contrast")]|merge(sectionClasses) %}
{% else %}
{% set sectionClasses = [zenCustomFields.category.zenit_horizon_category_image_contrast]|merge(sectionClasses) %}
{% endif %}
{# ... @zenit - opacity class #}
{% if sectionBgOpacity < 100 and sectionBgColor %}
{% set sectionClasses = ['has-opacity']|merge(sectionClasses) %}
{% endif %}
{% set layout = section.sizingMode ? section.sizingMode|replace({"_": "-"}) : "container" %}
{% block zen_page_content_section_category_image %}
<div class="cms-section {{ layout }} {{ sectionClasses|join(' ') }}"
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 %}">
{% if sectionBgOpacity < 100 and sectionBgColor %}
<div class="cms-section-bg-color-overlay"
style="background-color: {{ sectionBgColor }}; opacity: {{(100 - sectionBgOpacity|number_format) / 100 }};">
</div>
{% endif %}
{% sw_include "@Storefront/storefront/section/cms-section-" ~ section.type ~ ".html.twig" %}
</div>
{% endblock %}
{# ... @zenit - add default breadcrumbs, after first sections if it's an hero section #}
{% if defaultBreadcrumbs %}
{# ... @zenit - check if there is any breadcrumb to show #}
{% if sw_breadcrumb_full(page.header.navigation.active, context.context) %}
<div class="breadcrumb-container">
<div class="container">
<div class="breadcrumb-wrap cms-breadcrumb justify-content-{{ theme_config('zen-breadcrumbs-align')|replace({'flex-': ''}) }}">
{% block cms_breadcrumb %}
{% sw_include '@Storefront/storefront/layout/breadcrumb.html.twig' with {
navigationTree: page.header.navigation.tree,
category: page.header.navigation.active
} only %}
{% endblock %}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% else %}
{% set sectionBgColor = section.backgroundColor %}
{% set sectionBgImg = section.backgroundMedia|sw_encode_media_url %}
{% set sectionBgImgMode = section.backgroundMediaMode %}
{% if sectionBgImg %}
{% set sectionClasses = ['bg-image']|merge(sectionClasses) %}
{% endif %}
{% if sectionBgColor %}
{% set sectionClasses = ['bg-color']|merge(sectionClasses) %}
{% endif %}
{# ... @zenit - category overlay class #}
{% if loop.index is same as (1) and sectionCategoryOverlay is same as (true) %}
{% if sectionCategoryOverlay %}
{% set sectionClasses = ['cms-section-overlay']|merge(sectionClasses) %}
{% endif %}
{% endif %}
{% set layout = section.sizingMode ? section.sizingMode|replace({"_": "-"}) : "container" %}
{% block page_content_section %}
<div class="cms-section {{ layout }} {{ sectionClasses|join(' ') }}"
style="{% if sectionBgColor %}background-color: {{ sectionBgColor }};{% endif %}{% if sectionBgImg %}background-image: url('{{ sectionBgImg }}');background-size: {{ section.backgroundMediaMode }};{% endif %}">
{% sw_include "@Storefront/storefront/section/cms-section-" ~ section.type ~ ".html.twig" %}
</div>
{% endblock %}
{% endif %}
{% endfor %}
</div>
{% endblock %}