{% set sliders = sliderManager.getOnlineSliders() %}
{% if sliders is not empty %}
<div id="carousel_home" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
{% for key, slider in sliders %}
{% set position = (slider.position) - 1 %}
<button data-bs-target="#carousel_home" data-bs-slide-to="{{position}}" class="carousel-indicator {% if key == 0 %} active {% endif %}" aria-current="{{position}}"></button>
{% endfor %}
</div>
<div class="carousel-inner">
{% for key, slider in sliders %}
{% if slider.url is not null %}
<div class="carousel-item {% if key == 0 %} active {% endif %}">
{% set array_url = slider.url|split('://') %}
{% set url = slider.url %}
{% if array_url|length > 1 %}
{% set url = array_url[1] %}
{% endif %}
<a href="//{{ url }}" {% if slider.cible == true %} target="_blank" {% endif %}>
{# Affichage de l'image desktop #}
<img alt="{{ slider.mediaSliders[0].filePath }}" src="{{ slider.mediaSliders[0].filePath | imageFilePath('slider') }}" class="d-none d-sm-block w-100"/>
{# Ou affichage de l'image mobile #}
<img alt="{{ slider.mobileSliders[0].filePath }}" src="{{ slider.mobileSliders[0].filePath | imageFilePath('slider') }}" class="d-block d-sm-none w-100"/>
</a>
</div>
{% else %}
<div class="carousel-item {% if key == 0 %} active {% endif %}">
{# Affichage de l'image desktop #}
<img alt="{{ slider.mediaSliders[0].filePath }}" src="{{ slider.mediaSliders[0].filePath | imageFilePath('slider') }}" class="d-none d-sm-block w-100"/>
{# OU affichage de l'image mobile #}
<img alt="{{ slider.mobileSliders[0].filePath }}" src="{{ slider.mobileSliders[0].filePath | imageFilePath('slider') }}" class="d-block d-sm-none w-100"/>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}