1. 8.5.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  2. 8.0.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  3. 8.1.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  4. 8.2.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  5. 8.3.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  6. 8.4.x core/themes/classy/templates/dataset/item-list--search-results.html.twig
  7. 8.6.x core/themes/classy/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/classy/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. {% set attributes = attributes.addClass(classes) %}