views-view-list.html.twig

Same filename in this branch
  1. 8.9.x core/themes/classy/templates/views/views-view-list.html.twig
  2. 8.9.x core/modules/views/templates/views-view-list.html.twig
Same filename in other branches
  1. 9 core/themes/stable9/templates/views/views-view-list.html.twig
  2. 9 core/themes/stable/templates/views/views-view-list.html.twig
  3. 9 core/themes/starterkit_theme/templates/views/views-view-list.html.twig
  4. 9 core/themes/classy/templates/views/views-view-list.html.twig
  5. 9 core/modules/views/templates/views-view-list.html.twig
  6. 10 core/themes/stable9/templates/views/views-view-list.html.twig
  7. 10 core/themes/starterkit_theme/templates/views/views-view-list.html.twig
  8. 10 core/modules/views/templates/views-view-list.html.twig
  9. 11.x core/themes/stable9/templates/views/views-view-list.html.twig
  10. 11.x core/themes/starterkit_theme/templates/views/views-view-list.html.twig
  11. 11.x core/modules/views/templates/views-view-list.html.twig

Theme override for a view template to display a list of rows.

Available variables:

  • attributes: HTML attributes for the container.
  • rows: A list of rows for this list.
    • attributes: The row's HTML attributes.
    • content: The row's contents.
  • 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_views_view_list()

File

core/themes/stable/templates/views/views-view-list.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a view template to display a list of rows.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the container.
  8. * - rows: A list of rows for this list.
  9. * - attributes: The row's HTML attributes.
  10. * - content: The row's contents.
  11. * - title: The title of this group of rows. May be empty.
  12. * - list: @todo.
  13. * - type: Starting tag will be either a ul or ol.
  14. * - attributes: HTML attributes for the list element.
  15. *
  16. * @see template_preprocess_views_view_list()
  17. */
  18. #}
  19. {% if attributes -%}
  20. <div{{ attributes }}>
  21. {% endif %}
  22. {% if title %}
  23. <h3>{{ title }}</h3>
  24. {% endif %}
  25. <{{ list.type }}{{ list.attributes }}>
  26. {% for row in rows %}
  27. <li{{ row.attributes }}>
  28. {{- row.content -}}
  29. </li>
  30. {% endfor %}
  31. </{{ list.type }}>
  32. {% if attributes -%}
  33. </div>
  34. {% endif %}

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