summaryrefslogtreecommitdiffstats
path: root/core/modules/views/templates/views-view-grid.html.twig
blob: a5a813cce35c0db55973653b15f7cdb78d9f15fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{#
/**
 * @file
 * Default theme implementation for views to display rows in a grid.
 *
 * Available variables:
 * - 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.
 * - items: A list of grid items. Each item contains a list of rows or columns.
 *   The order in what comes first (row or column) depends on which alignment
 *   type is chosen (horizontal or vertical).
 *   - attributes: HTML attributes for each row or column.
 *   - content: A list of columns or rows. Each row or column contains:
 *     - attributes: HTML attributes for each row or column.
 *     - content: The row or column contents.
 *
 * @see template_preprocess_views_view_grid()
 *
 * @ingroup themeable
 */
#}
{% if title %}
  <h3>{{ title }}</h3>
{% endif %}
<div{{ attributes }}>
{% if options.alignment == 'horizontal' %}
  {% for row in items %}
  <div{{ row.attributes }}>
    {% for column in row.content %}
    <div{{ column.attributes }}>
      {{ column.content }}
    </div>
    {% endfor %}
  </div>
  {% endfor %}
{% else %}
  {% for column in items %}
  <div{{ column.attributes }}>
    {% for row in column.content %}
      <div{{ row.attributes }}>
        {{ row.content }}
      </div>
    {% endfor %}
    </div>
  {% endfor %}
{% endif %}
</div>