You are here

item-list--search-results.html.twig in Drupal 10

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".

File

core/themes/starterkit_theme/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) %}