templates/blog/shared/sections.html.twig line 1

  1. {#
    Template: sections.html.twig
    Usage: include or embed and pass `sections` (iterable) and optional `locale`.
    Example: {% include 'blog/shared/sections.html.twig' with { sections: sections, locale: app.request.locale } %}
    
    This template maps section.type values (BlocType constants) to rendering blocks.
    #}
    
    {% set locale = locale|default('fr') %}
    
    {% for section in sections %}
        {# Section thumbnail if present #}
        {% if section.thumbnail is not null and file_exists(section.thumbnail.url) %}
            <div class="section-thumbnail">
                <img src="{{ asset(section.thumbnail.url) }}" alt="{{ section.i18n(locale).name|raw }}"/>
            </div>
        {% endif %}
    
        {% set type = section.type|raw %}
    
        {# BLOC_ALTERNE_2_COULEURS (bloc-1) - 3 cols per row #}
        {% if type == 'bloc-1' %}
            <section data-type="{{ type }}"
                     class="section  py-3 py-lg-5 {{ section.classCss|raw }}  {% if loop.index != 1 %}mt-3 mt-lg-5{% endif %}">
                <div class="container">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                    <div class="listing-features mt-3 mt-lg-5">
                        <div class="row">
                            {% for item in section.items %}
                                <div class="col-12 col-sm-6 col-lg-4 item-feature text-center">
                                    <div class="feature-content h-100 d-flex flex-column py-3 px-2 px-md-3 py-md-4 gap-2 gap-lg-4">
                                        <div class="feature-number">{{ loop.index }}</div>
                                        <div class="feature-text">
                                            <h3 class="fw-bold mb-1">{{ item.i18n(locale).name|raw }}</h3>
                                            {{ item.i18n(locale).description|raw }}
                                        </div>
                                    </div>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </section>
    
            {# BLOC_ALTERNE_2_COULEURS_2 (bloc-11) - 2 cols per row #}
        {% elseif type == 'bloc-11' %}
            <section data-type="{{ type }}"
                     class="section py-3 py-lg-5  {% if loop.index != 1 %}mt-3 mt-lg-5{% endif %} {{ section.classCss }}">
                <div class="container py-lg-3">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                    <div class="listing-features mt-3 mt-lg-5 listing-features-2cols">
                        <div class="row">
                            {% for item in section.items %}
                                <div class="col-12 col-sm-6 item-feature text-center">
                                    <div class="feature-content h-100 d-flex flex-column py-3 px-2 px-md-3 py-md-4 gap-2 gap-lg-4">
                                        <div class="feature-number">{{ loop.index }}</div>
                                        <div class="feature-text">
                                            <h3 class="fw-bold mb-1">{{ item.i18n(locale).name|raw }}</h3>
                                            {{ item.i18n(locale).description|raw }}
                                        </div>
                                    </div>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </section>
    
            {# LISTE_ELEMENTS (bloc-2) #}
        {% elseif type == 'bloc-2' %}
            <section data-type="{{ type }}" class="section  py-3 py-lg-5 section-table {{ section.classCss|raw }}">
                <div class="container">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                </div>
                <div class="container">
                    <div class="responsive-table mt-3 mt-lg-5">
                        <div class="tab">
                            <div class="tab-contents">
                                <div>
                                    {% for item in section.items %}
                                        {{ item.i18n(locale).description|default(item.i18n(locale).name|raw)|raw }}
                                    {% endfor %}
                                </div>
                            </div>
                        </div>
    
                    </div>
                </div>
            </section>
    
            {# LISTE_BLOCS_ELEMENTS (bloc-10) #}
        {% elseif type == 'bloc-10' %}
            <section data-type="{{ type }}" class="section  py-3 py-lg-5 section-table {{ section.classCss|raw }}">
                <div class="container">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                </div>
                <div class="container">
                    <div class="mt-3 mt-lg-5 steps-table steps3-table">
                        {% for item in section.items %}
                            <div class="tab">
                                <div class="step-number">{{ loop.index }}</div>
                                <div class="tab-contents">
                                    <h3>{{ item.i18n(locale).name|raw }}</h3>
                                    {{ item.i18n(locale).description|raw }}
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </section>
    
            {# TABLEAU_AVEC_TITRE (bloc-3) #}
        {% elseif type == 'bloc-3' %}
            <section data-type="{{ type }}" class="section  py-3 py-lg-5 section-table {{ section.classCss|raw }}">
                <div class="container">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                </div>
                <div class="container">
                    <div class="responsive-table mt-3 mt-lg-5">
                        {% for item in section.items %}
                            <div class="tab">
                                <div class="tab-header">{{ item.i18n(locale).name|raw }}</div>
                                <div class="tab-contents">
                                    <div>
                                        {{ item.i18n(locale).description|raw }}
                                    </div>
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </section>
    
            {# SECTION_SIMPLE (bloc-4) #}
        {% elseif type == 'bloc-4' %}
            <section data-type="{{ type }}" class="section section-testimonials py-3 py-lg-5 {{ section.classCss|raw }}">
                <div class="container pb-lg-5">
                    {# Préparer background avec fallback si thumbnail disponible #}
                    {% set testimonialBg = 'vendors/assets/img/bg-testimony.jpg' %}
                    {% if section.thumbnail is not null and file_exists(section.thumbnail.url) %}
                        {% set testimonialBg = section.thumbnail.url %}
                    {% endif %}
                    <div class="testimonials text-white text-center py-5 px-3 px-md-5"
                         style="background-image: url('{{ asset(testimonialBg) }}');">
                        <div class="section-head  position-relative">
                            {% if section.i18n(locale).subTitle %}
                                <span>{{ section.i18n(locale).subTitle }}</span>{% endif %}
                            <h2>{{ section.i18n(locale).name|raw }}</h2>
                            {% if section.items|length > 0 %}
                                {{ section.items[0].i18n(locale).description|raw }}
                            {% else %}
                                {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                            {% endif %}
                        </div>
                    </div>
                </div>
            </section>
    
            {# BLOCS_IDENTIQUES (bloc-5) #}
        {% elseif type == 'bloc-5' %}
            <section data-type="{{ type }}" class="section section-network {{ section.classCss|raw }}">
                <div class="container py-2 py-lg-5">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                    <div class="pt-3 pt-lg-5 listing-network-infos row">
                        {% for item in section.items %}
                            <div class="col-md-4 info-network">
                                <div class="info-network-content d-flex flex-column gap-2 gap-lg-5 p-4 align-items-start">
                                    <div class="box-icon bg-greenlight">
                                        {% if item.thumbnail is not null and file_exists(item.thumbnail.url) %}
                                            <img alt="" src="{{ asset(item.thumbnail.url) }}"/>
                                        {% endif %}
                                    </div>
                                    <div class="network-content-text">
                                        <h3>{{ item.i18n(locale).name|raw }}</h3>
                                        {{ item.i18n(locale).description|raw }}
                                        {% if item.i18n(locale).link is defined and item.i18n(locale).link %}
                                            <a href="{{ item.i18n(locale).link }}"
                                               class="text-greenlight">{{ item.i18n(locale).linkLabel|default('En savoir plus') }}
                                                <i class="fa-solid fa-arrow-right"></i></a>
                                        {% endif %}
                                    </div>
                                </div>
                            </div>
                        {% endfor %}
    
                    </div>
                </div>
            </section>
    
            {# SECTION_IMAGE_ILLUSTRATION (bloc-6) #}
        {% elseif type == 'bloc-6' %}
            <section data-type="{{ type }}" class="section  py-5 section-palmares {{ section.classCss|raw }}">
                <div class="container">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                </div>
                <div class="position-relative">
                    <div class="container mx-auto pt-lg-5 px-lg-5">
                        <div class="row align-items-lg-center">
                            {% if section.items|length > 0 and section.items[0].thumbnail is not null and file_exists(section.items[0].thumbnail.url) %}
                                <div class="col-12 col-lg-4">
                                    <img alt="" src="{{ asset(section.items[0].thumbnail.url) }}"/>
                                </div>
                            {% endif %}
                            <div class="col-12 col-lg-8">
                                <div class="section-text">
                                    {% if section.items|length > 0 %}
                                        {{ section.items[0].i18n(locale).description|raw }}
                                    {% else %}
                                        {{ section.i18n(locale).description|raw }}
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
    
            {# SECTION_IMAGE_ILLUSTRATION_DROITE (bloc-7) #}
        {% elseif type == 'bloc-7' %}
            <section data-type="{{ type }}" class="section  pt-3 pt-lg-5 {{ section.classCss|raw }}">
                <div class="container">
                    <div class="row row-cols-1  row-cols-md-2 align-items-center flex-wrap-reverse  flex-md-wrap">
                        <div class="col">
                            <div class="section-text">
                                {% if section.items|length > 0 %}
                                    <h2>{{ section.items[0].i18n(locale).name|raw }}</h2>
                                    {{ section.items[0].i18n(locale).description|raw }}
                                {% else %}
                                    <h2>{{ section.i18n(locale).name|raw }}</h2>
                                    {{ section.i18n(locale).description|raw }}
                                {% endif %}
                            </div>
                        </div>
                        <div class="col">
                            {% if section.items|length > 0 and section.items[0].thumbnail is not null and file_exists(section.items[0].thumbnail.url) %}
                                <div class="thumb-col"><img class="mx-auto d-block"
                                                            src="{{ asset(section.items[0].thumbnail.url) }}" alt=""/>
                                </div>
                            {% elseif section.thumbnail is not null and file_exists(section.thumbnail.url) %}
                                <div class="thumb-col"><img class="mx-auto d-block"
                                                            src="{{ asset(section.thumbnail.url) }}" alt=""/></div>
                            {% endif %}
                        </div>
                    </div>
                </div>
            </section>
    
            {# SECTION_BLOCS_COLONNE (bloc-8) #}
        {% elseif type == 'bloc-8' %}
            <section data-type="{{ type }}" class="section  section-values py-3 py-lg-5 {{ section.classCss|raw }}">
                <div class="container">
                    <div class="row">
                        {% for item in section.items %}
                            <div class="col-12 col-sm-6 col-lg-4 featureAbout">
                                <div class="section-head section-headLeft">
                                    <div class="icon">
                                        {% if item.thumbnail %}
                                            <img src="{{ asset(item.thumbnail.url) }}" alt=""/>
                                        {% endif %}
                                    </div>
                                    <h2>{{ item.i18n(locale).name|raw }}</h2>
                                    {{ item.i18n(locale).description|raw }}
    
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </section>
    
            {# SECTION_TABLEAU (bloc-9) #}
        {% elseif type == 'bloc-9' %}
            <section data-type="{{ type }}" class="section {{ section.classCss|raw }} py-5">
                <div class="container ">
                    <div class="section-head text-center">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-green">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                </div>
                <div class="table-list pt-5">
                    <div class="container">
                        <div class="table-responsive px-lg-5">
                            <table class="table table-bordered ">
                                <thead class="">
                                <tr>
                                    {% for item in section.items %}
                                        {# if items represent columns, use their name as header; otherwise render first two as default headers #}
                                    {% endfor %}
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    {% for item in section.items %}
                                        <td class="bg-light2">
                                            {{ item.i18n(locale).description|raw|default(item.i18n(locale).name|raw) }}
                                        </td>
                                    {% endfor %}
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </section>
    
            {# SECTION_TABLEAU (bloc-12) Service supplémentaire #}
        {% elseif type == 'bloc-12' %}
            {{ render(controller("App\\Business\\Controller\\Public\\EmbedController::otherServices")) }}
        {% elseif type == 'bloc-13' %}
            {# Modal #}
            <div class="modal fade modalBox" id="modalBox{{ section.id }}" tabindex="-1" aria-labelledby="modalBoxLabel"
                 aria-hidden="true">
                <div class="modal-dialog modal-dialog-scrollable modal-dialog-centered modal-lg">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h1 class="modal-title fs-5">{{ section.i18n(locale).name|raw }}</h1>
                            <button type="button" class="btn-close" data-bs-dismiss="modal"
                                    aria-label="{{ 'close'|trans({}, 'app') }}"></button>
                        </div>
                        <div class="modal-body">
                            <div class="accordion" id="accordionModal{{ section.id }}">
                                {% for item in section.items %}
                                    <div class="accordion-item">
                                        <h2 class="accordion-header">
                                            <button class="accordion-button" type="button" data-bs-toggle="collapse"
                                                    data-bs-target="#collapse{{ item.id }}" aria-expanded="true"
                                                    aria-controls="collapse{{ item.id }}">
                                                {{ item.i18n(locale).name|raw }}
                                            </button>
                                        </h2>
                                        <div id="collapse{{ item.id }}" class="accordion-collapse collapse show"
                                             data-bs-parent="#accordionModal{{ section.id }}">
                                            <div class="accordion-body">
                                                {{ item.i18n(locale).description|raw }}
                                            </div>
                                        </div>
                                    </div>
                                {% endfor %}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {# SECTION_TABLEAU (bloc-14) présence stratigiques #}
        {% elseif type == 'bloc-14' %}
            {{ render(controller("App\\Business\\Controller\\Public\\EmbedController::presence")) }}
        {% elseif type == 'bloc-15' %}
            <section data-type="{{ type }}" class="section py-3 py-lg-5 section-timeline {{ section.classCss|raw }}">
                <div class="container">
                    <div class="section-head text-center section-head-full">
                        {% if section.i18n(locale).subTitle %}<span
                                class="text-subheading">{{ section.i18n(locale).subTitle }}</span>{% endif %}
                        <h2>{{ section.i18n(locale).name|raw }}</h2>
                        {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                    </div>
                    <div class="timeline mt-5 text-white">
                        {% for item in section.items %}
                            <div class="year">
                                <div class="year-content">
                                    <h3 class="year-value">{{ item.i18n(locale).name|raw }}</h3>
                                    <div class="year-text">
                                        {{ item.i18n(locale).description|raw }}
                                    </div>
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </section>
        {% elseif type == 'bloc-16' %}
            <section data-type="{{ type }}" class="section section-ambitions py-3 py-lg-5 {{ section.classCss|raw }}">
                <div class="container py-xl-5">
                    <div class="row">
                        <div class="col-md-4 mb-4 mb-md-0 ">
                            <div class="section-head section-headLeft">
                                {% if section.thumbnail is not null and file_exists(section.thumbnail.url) %}
                                    <div class="icon">
                                        <img src="{{ asset(section.thumbnail.url) }}" alt="">
                                    </div>
                                {% endif %}
                                <h2>{{ section.i18n(locale).name|raw }}</h2>
                                {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="row">
                                {% for item in section.items %}
                                    <div class="col-sm-6 mb-4 item-value">
                                        <div class="item-value-content d-flex flex-column gap-5 p-4 align-items-start">
                                            {% if item.thumbnail is not null and file_exists(item.thumbnail.url) %}
                                                <div class="box-icon bg-greenlight">
                                                    <img alt=" " src="{{ asset(item.thumbnail.url) }}">
                                                </div>
                                            {% endif %}
                                            <div>
                                                <h4 class="fw-bold mb-1">{{ item.i18n(locale).name|raw }}</h4>
                                                {{ item.i18n(locale).description|raw }}
                                            </div>
                                        </div>
                                    </div>
                                {% endfor %}
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        {% elseif type == 'bloc-17' %}
            <section data-type="{{ type }}" class="section section-values py-5 {{ section.classCss|raw }}">
                <div class="container py-xl-5">
                    <div class="row">
                        <div class="col-md-4 mb-4 mb-md-0 ">
                            <div class="section-head section-headLeft">
                                {% if section.thumbnail is not null and file_exists(section.thumbnail.url) %}
                                    <div class="icon">
                                        <img src="{{ asset(section.thumbnail.url) }}" alt="">
                                    </div>
                                {% endif %}
                                <h2>{{ section.i18n(locale).name|raw }}</h2>
                                {% if section.i18n(locale).description %}{{ section.i18n(locale).description|raw }}{% endif %}
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="row">
                                {% for item in section.items %}
                                    <div class="col-sm-6 mb-4 item-value">
                                        <h4 class="fw-bold mb-1">{{ item.i18n(locale).name|raw }}</h4>
                                        {{ item.i18n(locale).description|raw }}
                                    </div>
                                {% endfor %}
                            </div>
                        </div>
                    </div>
                </div>
            </section>
            {# Fallback: render description or the items list when type is unknown #}
        {% else %}
            {% if section.i18n is defined and section.i18n(locale).description is defined and section.i18n(locale).description %}
                <section data-type="{{ type }}"
                         class="section-description">{{ section.i18n(locale).description|raw }}</section>
            {% else %}
                <section data-type="{{ type }}" class="section-items">
                    {% for item in section.items %}
                        <div class="item">
                            <h4>{{ item.i18n(locale).name|raw }}</h4>
                            <div class="content">{{ item.i18n(locale).description|raw }}</div>
                        </div>
                    {% endfor %}
                </section>
            {% endif %}
        {% endif %}
    {% endfor %}