{% sw_extends '@Storefront/storefront/page/content/detail.html.twig' %}
{% block page_content_section %}
{% set foxDomainReplace = {} %}
{% if config('FuexcImageCDN.config.cdnUrl')and config('FuexcImageCDN.config.rewriteBackgroundImages') %}
{% 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 %}
{% set sectionBgImg = sectionBgImg | replace(foxDomainReplace) %}
{{ parent() }}
{% endblock %}