You are here

views-accordion-view.html.twig in Views Accordion 8

Same filename and directory in other branches
  1. 2.0.x templates/views-accordion-view.html.twig

Theme override to display a views_accordion set of rows.

Available variables:

  • title: The title of this group of rows. May be empty.
  • rows: A list of the view's row items.
    • attributes: The row's HTML attributes.
    • content: The row's content.
  • view: The view object.
  • default_row_class: A flag indicating whether default classes should be used on rows.

File

templates/views-accordion-view.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a views_accordion set of rows.
  5. *
  6. * Available variables:
  7. * - title: The title of this group of rows. May be empty.
  8. * - rows: A list of the view's row items.
  9. * - attributes: The row's HTML attributes.
  10. * - content: The row's content.
  11. * - view: The view object.
  12. * - default_row_class: A flag indicating whether default classes should be
  13. * used on rows.
  14. *
  15. * @see template_preprocess_views_accordion_view()
  16. */
  17. #}
  18. {% if title %}
  19. <h3 class="js-views-accordion-group-header">{{ title }}</h3>
  20. {% endif %}
  21. {% for row in rows %}
  22. {%
  23. set row_classes = [
  24. default_row_class ? 'views-row',
  25. ]
  26. %}
  27. {# A div wrapping the row content is required for the accordion to work #}
  28. <div{{ row.attributes.addClass(row_classes) }}>
  29. {{ row.content }}
  30. </div>
  31. {% endfor %}