{% sw_extends '@NenoHeroSlider/storefront/include/neno-hero-slider.html.twig' %}
{% block neno_hero_slider %}
{% set foxDomainReplace = {} %}
{% if config('FuexcImageCDN.config.cdnUrl') and config('FuexcImageCDN.config.rewriteThumbnails') %}
{% set foxDomainReplace = {
"https://cdn.shopware.store": config('FuexcImageCDN.config.cdnUrl')|trim('/')
} %}
{% for salesChannelDomain in context.salesChannel.domains %}
{% set foxDomain = salesChannelDomain.url|split('//') %}
{% if foxDomain|length == 1 %}
{% set foxDomain = "#{(foxDomain[0]|split('/')[0])}" %}
{% elseif foxDomain|length == 2 %}
{% set foxDomain = "#{foxDomain[0]}//#{(foxDomain[1]|split('/')[0])}" %}
{% endif %}
{% set foxDomainReplace = foxDomainReplace|merge({
(foxDomain): config('FuexcImageCDN.config.cdnUrl')|trim('/')
}) %}
{% endfor %}
{% endif %}
{{ parent() }}
{% endblock %}
{% block neno_hero_slider_slide_portrait_srcset %}
{% if slide.mediaPortrait.thumbnails|length > 0 %}
{% set thumbnails = slide.mediaPortrait.thumbnails|sort|reverse %}
{# generate srcset with all available thumbnails #}
{% set srcsetValue %}{% apply spaceless %}
{{ slide.mediaPortrait|sw_encode_media_url|replace(foxDomainReplace) }} {{ thumbnails|first.width + 1 }}w, {% for thumbnail in thumbnails %}{{ thumbnail.url | sw_encode_url }} {{ thumbnail.width }}w{% if not loop.last %}, {% endif %}{% endfor %}
{% endapply %}{% endset %}
data-srcset-portrait="{{ srcsetValue }}"
{% endif %}
data-src-portrait="{{ slide.mediaPortrait|sw_encode_media_url|replace(foxDomainReplace) }}"
{% endblock %}
{% block neno_hero_slider_slide_landscape_srcset %}
{% if slide.mediaLandscape.thumbnails|length > 0 %}
{% set thumbnails = slide.mediaLandscape.thumbnails|sort|reverse %}
{# generate srcset with all available thumbnails #}
{% set srcsetValue %}{% apply spaceless %}
{{ slide.mediaLandscape|sw_encode_media_url|replace(foxDomainReplace) }} {{ thumbnails|first.width + 1 }}w, {% for thumbnail in thumbnails %}{{ thumbnail.url | sw_encode_url }} {{ thumbnail.width }}w{% if not loop.last %}, {% endif %}{% endfor %}
{% endapply %}{% endset %}
data-srcset-landscape="{{ srcsetValue }}"
{% endif %}
data-src-landscape="{{ slide.mediaLandscape|sw_encode_media_url|replace(foxDomainReplace) }}"
{% endblock %}