You are here

custom-search-results.html.twig in Custom Search 8

Default theme implementation for an item list.

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.
  • filter: A list of links for results filtering.
  • filter_position: The position of the filter ("above" or "below").

File

templates/custom-search-results.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for an item list.
  5. *
  6. * Available variables:
  7. * - items: A list of items. Each item contains:
  8. * - attributes: HTML attributes to be applied to each list item.
  9. * - value: The content of the list element.
  10. * - title: The title of the list.
  11. * - list_type: The tag for list element ("ul" or "ol").
  12. * - attributes: HTML attributes to be applied to the list.
  13. * - empty: A message to display when there are no items. Allowed value is a
  14. * string or render array.
  15. * - filter: A list of links for results filtering.
  16. * - filter_position: The position of the filter ("above" or "below").
  17. *
  18. * @see custom_search_preprocess_item_list__search_results()
  19. *
  20. * @ingroup themeable
  21. */
  22. #}
  23. {%- if items or empty -%}
  24. <div class="item-list">
  25. {%- if title is not empty -%}
  26. <h3>{{ title }}</h3>
  27. {%- endif -%}
  28. {%- if items -%}
  29. {%- if filter_position=='above' -%}
  30. {{ filter }}
  31. {%- endif -%}
  32. <{{ list_type }}{{ attributes }}>
  33. {%- for item in items -%}
  34. <li{{ item.attributes }}>{{ item.value }}</li>
  35. {%- endfor -%}
  36. </{{ list_type }}>
  37. {%- if filter_position=='below' -%}
  38. {{ filter }}
  39. {%- endif -%}
  40. {%- else -%}
  41. {{- empty -}}
  42. {%- endif -%}
  43. </div>
  44. {%- endif %}