{% sw_extends '@Storefront/storefront/page/content/index.html.twig' %}
{% block page_content %}
{% if page.cmsPage.sections|length and page.cmsPage.sections.first().blocks|length == 1 and (page.cmsPage.sections.first().blocks.first().type in ['image','text-on-image']) %}
{% set teaserKey = page.cmsPage.sections.getKeys()[0] %}
{% set hasTeaser = page.cmsPage.sections.get(teaserKey) %}
{% set dummy = page.cmsPage.sections.remove(teaserKey) %}
{% else %}
{% set hasTeaser = 0 %}
{% endif %}
{% if hasTeaser %}
{% set section = hasTeaser %}
{% set sectionBgColor = section.backgroundColor %}
{% set sectionBgImg = section.backgroundMedia|sw_encode_media_url %}
{% set sectionBgImgMode = section.backgroundMediaMode %}
{% set sectionClasses = [section.cssClass, 'pos-' ~ section.position, 'cms-section-' ~ section.type] %}
{% if sectionBgImg %}
{% set sectionClasses = ['bg-image']|merge(sectionClasses) %}
{% endif %}
{% if sectionBgColor %}
{% set sectionClasses = ['bg-color']|merge(sectionClasses) %}
{% endif %}
<div class="cms-teaser"
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>
{% endif %}
{% if controllerAction|lower != 'home' %}
<div class="breadcrumb cms-breadcrump container" itemscope itemtype="http://schema.org/BreadcrumbList">
{% block cms_breadcrumb %}
{% endblock %}
</div>
{% endif %}
<div class="cms-page">
{% block page_content_blocks %}
{% sw_include "@Storefront/storefront/page/content/detail.html.twig" with {'cmsPage': page.cmsPage} %}
{% endblock %}
</div>
{% endblock %}