{# Widget Hero polyvalent - Supporte gradient, image, carrousel, vidéo #} {% set backgroundType = config.backgroundType|default('gradient') %} {% set height = config.height|default('medium') %} {% set textAlignment = config.textAlignment|default('center') %} {% set textColor = config.textColor|default('#ffffff') %} {% set padding = config.padding|default('60px 20px') %} {# Calcul de la hauteur #} {% set heightValue = 'auto' %} {% set minHeightValue = 'auto' %} {% if height == 'small' %} {% set heightValue = 'auto' %} {% set minHeightValue = '150px' %} {% elseif height == 'medium' %} {% set heightValue = '400px' %} {% set minHeightValue = '400px' %} {% elseif height == 'large' %} {% set heightValue = '600px' %} {% set minHeightValue = '600px' %} {% elseif height == 'fullscreen' %} {% set heightValue = '100vh' %} {% set minHeightValue = '100vh' %} {% endif %}
{# Fond selon le type #} {% if backgroundType == 'gradient' %} {# Fond dégradé #} {% set color1 = config.gradientColor1|default(config.gradientColors[0]|default('#667eea')) %} {% set color2 = config.gradientColor2|default(config.gradientColors[1]|default('#764ba2')) %}
{% elseif backgroundType == 'image' %} {# Fond image statique #}
{% if config.overlay|default(true) %}
{% endif %} {% elseif backgroundType == 'carousel' %} {# Carrousel d'images avec contenu par slide #} {% set carouselId = 'hero-carousel-' ~ random() %} {% set slides = config.carouselSlides|default([]) %} {% if config.overlay|default(true) %}
{% endif %} {% elseif backgroundType == 'video' %} {# Vidéo de fond #}
{% if config.videoType == 'youtube' and config.videoId %} {% elseif config.videoType == 'vimeo' and config.videoId %} {% elseif config.videoType == 'local' and config.videoUrl %} {% endif %}
{% if config.overlay|default(true) %}
{% endif %} {% endif %} {# Boutons de navigation du carrousel - en dehors pour éviter conflits z-index #} {% if backgroundType == 'carousel' and config.carouselSlides is defined and config.carouselSlides|length > 1 %} {% endif %} {# Contenu #} {% if backgroundType == 'carousel' and config.carouselSlides is defined and config.carouselSlides|length > 0 %} {# Contenu dynamique pour chaque slide du carrousel #} {% for slide in config.carouselSlides %}
{% if slide.title %}

{{ slide.title }}

{% endif %} {% if slide.subtitle %}

{{ slide.subtitle }}

{% endif %} {% if slide.showCta|default(false) and slide.ctaText %} {{ slide.ctaText }} {% endif %}
{% endfor %} {% else %} {# Contenu statique pour les autres types (gradient, image, video) #}
{% if config.title %}

{{ config.title }}

{% endif %} {% if config.subtitle %}

{{ config.subtitle }}

{% endif %} {% if (config.showCta is defined and config.showCta and config.ctaText is defined) or (config.showCta is not defined and config.ctaText is defined) %} {{ config.ctaText|default('En savoir plus') }} {% endif %}
{% endif %}
{% if backgroundType == 'carousel' and config.carouselSlides is defined and config.carouselSlides|length > 1 %} {% endif %}