You are here

uikit-view-grid.html.twig in UIkit Components 8.2

Theme override for views to display rows in a grid.

Available variables:

  • id: The unique id for the wrapping element.
  • attributes: HTML attributes for the wrapping element.
  • title: The title of this group of rows.
  • view: The view object.
  • rows: The rendered view results.
  • options: The view plugin style options.
    • grid_divider: A flag indicating whether default classes should be used on rows.
  • grid_classes: HTML classes for the grid container element.
  • items: A list of grid items. Each item contains:
    • content: The columns's contents.

File

uikit_views/templates/views/uikit-view-grid.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for views to display rows in a grid.
  5. *
  6. * Available variables:
  7. * - id: The unique id for the wrapping element.
  8. * - attributes: HTML attributes for the wrapping element.
  9. * - title: The title of this group of rows.
  10. * - view: The view object.
  11. * - rows: The rendered view results.
  12. * - options: The view plugin style options.
  13. * - grid_divider: A flag indicating whether default classes should be
  14. * used on rows.
  15. * - grid_classes: HTML classes for the grid container element.
  16. * - items: A list of grid items. Each item contains:
  17. * - content: The columns's contents.
  18. *
  19. * @see template_preprocess_uikit_view_grid()
  20. */
  21. #}
  22. {{ attach_library('uikit_views/uikit-view-grid') }}
  23. {%
  24. set classes = [
  25. 'views-view-grid',
  26. 'uikit-view-grid',
  27. options.grid_divider ? 'uikit-view-grid-divider',
  28. ]
  29. %}
  30. {% if title %}
  31. <h3>{{ title }}</h3>
  32. {% endif %}
  33. <div id="{{ id }}" {{ attributes.addClass(classes) }}>
  34. <ul class="{{ grid_classes }}">
  35. {% for column in items %}
  36. <li>{{ column.content }}</li>
  37. {% endfor %}
  38. </ul>
  39. </div>