<div id="slideshowId" class="flexslider">
    <ul class="slides">
        {% for slide in slides %}
            <li>
                {% if isHomePage and diaporama_image_home_filter is defined %}
                    {{ ez_render_field(slide, 'image', { parameters: { alias: diaporama_image_home_filter } }) }}
                {% elseif diaporama_image_filter is defined %}
                    {{ ez_render_field(slide, 'image', { parameters: { alias: diaporama_image_filter } }) }}
                {% else %}
                    {{ ez_render_field(slide, 'image') }}
                {% endif %}
                {% if rootLocationId == ezpublish.rootLocation.id %}
                    {#{% if contentsForTemplates[slide.contentInfo.id] is defined %}#}
                    {#{% for accroche in contentsForTemplates[slide.contentInfo.id] %}#}
                    <div class="wrapper">
                        {% set link =  '' %}
                        {% if slide.fields.lien_interne is defined and not ez_is_field_empty( slide, "lien_interne" ) %}
                            {% set content = load_content_by_content_id(slide.getFieldValue("lien_interne").destinationContentId) %}
                            {% set link =  path('ez_urlalias', {'locationId': content.contentInfo.mainLocationId})  %}
                        {% elseif slide.fields.lien_externe is defined and not ez_is_field_empty( slide, "lien_externe" ) %}
                            {% set link =  slide.getFieldValue("lien_interne").link %}
                        {% endif %}
                        {% if not ez_is_field_empty(slide, "titre_accroche" ) or not ez_is_field_empty( slide, "sous_titre_accroche" ) or link %}
                            <div class="container">
                                <div class="caption">
                                    <div class="text caption-txt-theme {% if link %}fitted{% endif %}">
                                        <div class="centred-text">
                                            {% if not ez_is_field_empty(slide, "titre_accroche" ) %}
                                                <span>{{ ez_render_field(slide, "titre_accroche") }}</span>
                                            {% endif %}
                                            {% if not ez_is_field_empty( slide, "sous_titre_accroche" ) %}
                                                {{ ez_render_field(slide, "sous_titre_accroche") }}
                                            {% endif %}
                                            {% if link %}
                                                <a class="plus" href="{{ link }}" {% if slide.getFieldValue('nouvelle_fenetre').bool %}rel="external" target="blanc"{% endif %}></a>
                                            {% endif %}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        {% endif %}
                    </div>
                    {#{% endfor %}#}
                    {#{% endif %}#}
                {% endif %}
            </li>
        {% endfor %}
    </ul>
</div>
