{% sw_extends'@Storefront/storefront/layout/header/logo.html.twig' %}
{% block layout_header_logo_image %}
{% set boedenSalesChannelIdFromConfig = config('FourtwosixThemeExtension.config.boedenSalesChannelId') %}
{% set italianLanguageIdFromConfig = config('FourtwosixThemeExtension.config.languageIt') %}
{% set ftsPavimenti24MediaId = config('FourtwosixThemeExtension.config.ftsPavimenti24Media') %}
{% set isBoeden = context.salesChannelId == boedenSalesChannelIdFromConfig %}
{% set isItalianLanguage = context.languageId == italianLanguageIdFromConfig %}
{% set mediaCollection = searchMedia([ftsPavimenti24MediaId], context.context) %}
{% set pavimenti24MediaURL = mediaCollection.get(ftsPavimenti24MediaId).url %}
{# @fourtwosix-edit: change the logo only for Boeden Italian and check if mediaURL is set #}
{% if(isBoeden and isItalianLanguage and ftsPavimenti24MediaId) %}
{% set mobileLogo = pavimenti24MediaURL %}
{% set tabletLogo = pavimenti24MediaURL %}
{% set desktopLogo = pavimenti24MediaURL %}
{% else %}
{% set mobileLogo = theme_config('sw-logo-tablet') |sw_encode_url %}
{% set tabletLogo = theme_config('sw-logo-mobile') |sw_encode_url %}
{% set desktopLogo = theme_config('sw-logo-desktop') |sw_encode_url %}
{% endif %}
{# @fourtwosix-edit: end ------------------------------------------------ #}
<picture class="header-logo-picture">
{% block layout_header_logo_image_tablet %}
{% if theme_config('sw-logo-tablet') and theme_config('sw-logo-tablet') != theme_config('sw-logo-desktop') %}
{# @fourtwosix-edit: changed the url of the picture src #}
<source srcset="{{ tabletLogo }}" media="(min-width: {{ theme_config('breakpoint.md') }}px) and (max-width: {{ theme_config('breakpoint.lg') - 1 }}px)">
{# @fourtwosix-edit: end ------------------------------------ #}
{% endif %}
{% endblock %}
{% block layout_header_logo_image_mobile %}
{% if theme_config('sw-logo-mobile') and theme_config('sw-logo-mobile') != theme_config('sw-logo-desktop') %}
{# @fourtwosix-edit: changed the url of the picture src #}
<source srcset="{{ mobileLogo }}" media="(max-width: {{ theme_config('breakpoint.md') - 1 }}px)">
{# @fourtwosix-edit: end ------------------------------------ #}
{% endif %}
{% endblock %}
{% block layout_header_logo_image_default %}
{% if theme_config('sw-logo-desktop') %}
{# @fourtwosix-edit: changed the url of the picture src #}
<img src="{{ desktopLogo }}" alt="{{ "header.logoLink"|trans|striptags }}" class="img-fluid header-logo-main-img"/>
{# @fourtwosix-edit: end ------------------------------------ #}
{% endif %}
{% endblock %}
</picture>
{% endblock %}