{# 'this' est une variable magique dans un template de composant. Elle fait référence à notre instance de 'ActualiteSearchComponent.php'. #}
{# === LE CHAMP DE RECHERCHE LIÉ === #}
{# On exécute notre méthode getPagination() du composant PHP et on stocke le résultat dans une variable 'pagination' locale. #} {% set pagination = this.getPagination() %} {# MAINTENANT, ON COLLE TA BOUCLE D'AFFICHAGE COMPLÈTE (exactement comme elle était dans index.html.twig) #} {% if pagination.getTotalItemCount() > 0 %}
{% for article in pagination %}
{% if article.image %}
{{ article.title }}
{% endif %}

{{ article.title }}

{{ article.content|striptags|slice(0, 150) ~ '...' }}

Lire la suite {% if is_granted('ROLE_ADMIN') %} Modifier
{% endif %}
{% endfor %} {# LA PAGINATION (utilise notre template personnalisé pour LiveComponent) #}
{% else %} {# LE MESSAGE "AUCUN ARTICLE" (adapté avec 'this.query') #}

{% if this.query is not empty %} Aucun article trouvé pour "{{ this.query }}" {% else %} Aucun article publié {% endif %}

{% if this.query is not empty %} Essayez avec d'autres mots-clés. {% else %} Il n'y a pas encore d'articles disponibles. Revenez bientôt ! {% endif %}

{% endif %}