views-view-list.html.twig

Default theme implementation for a view template to display a list of rows.

Available variables:

  • rows: A list of rows for this list.
  • row_classes: The row's HTML attributes correlating with the row's 'id'.
  • title: The title of this group of rows. May be empty.
  • list: @todo.
    • type: Starting tag will be either a ul or ol.
    • attributes: HTML attributes for the list element.

See also

template_preprocess()

template_preprocess_views_view_list()

File

drupal/core/modules/views/templates/views-view-list.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a view template to display a list of rows.
  5. *
  6. * Available variables:
  7. * - rows: A list of rows for this list.
  8. * - row_classes: The row's HTML attributes correlating with the row's 'id'.
  9. * - title: The title of this group of rows. May be empty.
  10. * - list: @todo.
  11. * - type: Starting tag will be either a ul or ol.
  12. * - attributes: HTML attributes for the list element.
  13. *
  14. * @see template_preprocess()
  15. * @see template_preprocess_views_view_list()
  16. *
  17. * @ingroup themeable
  18. */
  19. #}
  20. {% if wrapper_attributes -%}
  21. <div{{ wrapper_attributes }}>
  22. {% endif %}
  23. {% if title %}
  24. <h3>{{ title }}</h3>
  25. {% endif %}
  26. {% if list.type == 'ul' %}
  27. <ul{{ list.attributes }}>
  28. {% else %}
  29. <ol{{ list.attributes }}>
  30. {% endif %}
  31. {% for id, row in rows %}
  32. <li{{ row_classes[id] }}>{{ row }}</li>
  33. {% endfor %}
  34. {% if list.type == 'ul' %}
  35. </ul>
  36. {% else %}
  37. </ol>
  38. {% endif %}
  39. {% if wrapper_attributes -%}
  40. </div>
  41. {% endif %}

Related topics