You are here

views-view-responsive-grid.html.twig in Views Responsive Grid 8

Default theme implementation for views to display rows in a responsive grid.

Available variables:

  • attributes: HTML attributes for the wrapping div element.
  • title: The title of this group of rows.
  • view: The view object.
  • rows: The rendered view results array.
  • options: The view plugin style options.
  • items: Contains a nested array of grid items. The structure of this array
  • depends on the value of options.alignment.
  • row_attributes: HTML attributes for each grid row. The structure of this array depends on the value of options.alignment.
  • col_attributes: HTML attributes for each grid column. The structure of this array depends on the value of options.alignment.

See also

template_process_views_view_responsive_grid()

File

templates/views-view-responsive-grid.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for views to display rows in a responsive grid.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the wrapping div element.
  8. * - title: The title of this group of rows.
  9. * - view: The view object.
  10. * - rows: The rendered view results array.
  11. * - options: The view plugin style options.
  12. * - items: Contains a nested array of grid items. The structure of this array
  13. * - depends on the value of options.alignment.
  14. * - row_attributes: HTML attributes for each grid row. The structure of this
  15. * array depends on the value of options.alignment.
  16. * - col_attributes: HTML attributes for each grid column. The structure of this
  17. * array depends on the value of options.alignment.
  18. *
  19. * @see template_process_views_view_responsive_grid()
  20. *
  21. * @ingroup themeable
  22. * @ingroup views_templates
  23. */
  24. #}
  25. {% if title %}
  26. <h3>{{ title }}</h3>
  27. {% endif %}
  28. <div{{ attributes }}>
  29. {% if options.alignment == 'horizontal' %}
  30. {% for row_key, row in items %}
  31. <div{{ row_attributes[row_key] }}>
  32. {% for col_key, col in row %}
  33. <div{{ col_attributes[row_key][col_key] }}>
  34. {{ items[row_key][col_key] }}
  35. </div>
  36. {% endfor %}
  37. </div>
  38. {% endfor %}
  39. {% else %}
  40. {% for col_key, column in items %}
  41. <div{{ col_attributes[col_key] }}>
  42. {% for row_key, row in column %}
  43. <div{{ row_attributes[col_key][row_key] }}>
  44. {{ items[col_key][row_key] }}
  45. </div>
  46. {% endfor %}
  47. </div>
  48. {% endfor %}
  49. {% endif %}
  50. </div>