item-list--search-results.html.twig

Same filename in this branch
  1. 9 core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
  2. 9 core/themes/seven/templates/classy/dataset/item-list--search-results.html.twig
  3. 9 core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
  4. 9 core/themes/bartik/templates/classy/dataset/item-list--search-results.html.twig
  5. 9 core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig
  6. 9 core/themes/classy/templates/dataset/item-list--search-results.html.twig
Same filename in other branches
  1. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
  2. 8.9.x core/themes/seven/templates/classy/dataset/item-list--search-results.html.twig
  3. 8.9.x core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
  4. 8.9.x core/themes/bartik/templates/classy/dataset/item-list--search-results.html.twig
  5. 8.9.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  6. 10 core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
  7. 10 core/themes/olivero/templates/dataset/item-list--search-results.html.twig
  8. 10 core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
  9. 10 core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig
  10. 11.x core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
  11. 11.x core/themes/olivero/templates/dataset/item-list--search-results.html.twig
  12. 11.x core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
  13. 11.x core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig

Theme override for an item list of search results.

Available variables:

  • items: A list of items. Each item contains:

    • attributes: HTML attributes to be applied to each list item.
    • value: The content of the list element.
  • title: The title of the list.
  • list_type: The tag for list element ("ul" or "ol").
  • attributes: HTML attributes to be applied to the list.
  • empty: A message to display when there are no items. Allowed value is a string or render array.
  • context: An list of contextual data associated with the list. For search results, the following data is set:

    • plugin: The search plugin ID, for example "node_search".

See also

template_preprocess_item_list()

2 theme calls to item-list--search-results.html.twig
SearchController::view in core/modules/search/src/Controller/SearchController.php
Creates a render array for the search page.
SearchController::view in core/modules/search/src/Controller/SearchController.php
Creates a render array for the search page.

File

core/themes/olivero/templates/dataset/item-list--search-results.html.twig

View source
  1. {% extends "item-list.html.twig" %}
  2. {#
  3. /**
  4. * @file
  5. * Theme override for an item list of search results.
  6. *
  7. * Available variables:
  8. * - items: A list of items. Each item contains:
  9. * - attributes: HTML attributes to be applied to each list item.
  10. * - value: The content of the list element.
  11. * - title: The title of the list.
  12. * - list_type: The tag for list element ("ul" or "ol").
  13. * - attributes: HTML attributes to be applied to the list.
  14. * - empty: A message to display when there are no items. Allowed value is a
  15. * string or render array.
  16. * - context: An list of contextual data associated with the list. For search
  17. * results, the following data is set:
  18. * - plugin: The search plugin ID, for example "node_search".
  19. *
  20. * @see template_preprocess_item_list()
  21. */
  22. #}
  23. {%
  24. set classes = [
  25. 'search-results',
  26. context.plugin ~ '-results',
  27. ]
  28. %}
  29. {%
  30. set listClasses = [
  31. 'search-results__item',
  32. ]
  33. %}
  34. {% set attributes = attributes.addClass(classes) %}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.