templates/common/searchResult.html.twig line 1

Open in your IDE?
  1. {% macro renderTeasersList(method, entities, listWithThumbnails = false) %}
  2.     {% set ids = "" %}
  3.     {% for entity in entities %}
  4.         {% if ids == "" %}
  5.             {% set ids = ids ~ entity.id %}
  6.         {% else %}
  7.             {% set ids = ids ~ "-" ~ entity.id %}
  8.         {% endif %}
  9.     {% endfor %}
  10.     {{ render(controller(method, {'ids': ids, 'listWithThumbnails': listWithThumbnails})) }}
  11. {% endmacro %}
  12. {% import _self as selfm %}
  13. {% if listWithThumbnails is not defined %}
  14.     {% set listWithThumbnails = false %}
  15. {% endif %}
  16. <h1>
  17.     {% if title is not defined %}
  18.         Recherche : {{term}}
  19.     {% else %}
  20.         {{ title|raw }}
  21.     {% endif %}
  22. </h1>
  23. {% if not articles and not events and not questionAnswers and not structures %}
  24.     
  25.     <p>Votre recherche <strong>{{term}}</strong> ne donne aucun résultat.</p>
  26. {% else %}
  27.     <p>
  28.         Voici les résultats de votre recherche : <strong>{{term}}</strong><br/>
  29.         {% if theme is defined and theme is not null and theme.tags is not empty and is_granted('ROLE_EDITOR') %}
  30.             Le thème est défini par ces mots-clés : {{ theme.tags|join(", ") }}
  31.         {% endif %}
  32.     </p>
  33.     <div class="resultats-recherche-wrapper">
  34.         {# 
  35.         {{ dump(articles) }}
  36.         {{ dump(events) }}
  37.         {{ dump(questionAnswers) }}
  38.         {{ dump(structures) }}
  39.         #}
  40.         {% if questionAnswers %}
  41.             {{ selfm.renderTeasersList('App\\Controller\\QuestionAnswerController::showSearchResult', questionAnswers, listWithThumbnails) }}
  42.         {% endif %}
  43.         {% if structures %}
  44.             {{ selfm.renderTeasersList('App\\Controller\\StructureController::showSearchResult', structures, listWithThumbnails) }}
  45.         {% endif %} 
  46.         {% if articles %}    
  47.             {{ selfm.renderTeasersList('App\\Controller\\ArticleController::showSearchResult', articles, listWithThumbnails) }}
  48.         {% endif %}
  49.         {% if events %}
  50.             {{ selfm.renderTeasersList('App\\Controller\\EventController::showSearchResult', events, listWithThumbnails) }}
  51.         {% endif %}
  52.     </div>
  53. {% endif %}
  54. <p>
  55.     Une erreur ? Un complément à ajouter ? <a href="{{ path('contact') }}"><strong>Signalez-le nous !</strong></a>
  56. </p>
  57. <h2>Vous souhaitez faire une autre recherche ?</h2>
  58. <div class="mt-3 mb-4 themes-search">
  59.     <p>Faites une <strong>recherche par thème</strong></p>
  60.     <div class="row row-cols-lg-6 row-cols-md-4 row-cols-sm-3 row-cols-3 themes">
  61.         {{ render(controller('App\\Controller\\ThemeController:showThemes')) }}
  62.     </div>
  63. </div>
  64. <div class="recherche">
  65.     <p>Ou <strong>tapez un mot-clé</strong></p>
  66.     {# {{ form(searchForm) }} #}
  67.     {{ render(controller('App\\Controller\\TagController:showTagForm')) }}
  68.     <p>
  69.         <a href="{{ path('tagsList') }}">Voir la liste des tags</a>
  70.     </p>
  71. </div>