Newer
Older
Alex Pott
committed
{#
/**
* @file
* Default theme implementation for displaying a view as a table.
*
* Available variables:
* - attributes: Remaining HTML attributes for the element.
* - class: HTML classes that can be used to style contextually through CSS.
* - title : The title of this group of rows.
* - header: Header labels.
* - header_classes: HTML classes to apply to each header cell, indexed by
* the header's key.
* - caption_needed: Is the caption tag needed.
* - caption: The caption for this table.
* - accessibility_description: Extended description for the table details.
* - accessibility_summary: Summary for the table details.
Alex Pott
committed
* - rows: Table row items. Rows are keyed by row number, fields within rows
* are keyed by field ID.
* - field: Table data field ID.
* - content: Table data content.
* - row_classes: HTML classes to apply to each row, indexed by row number.
* This matches the index in rows.
* - field_classes: HTML classes to apply to each row, indexed by row number.
* This matches the index in columns and rows.
*
* @see template_preprocess_views_view_table()
*
* @ingroup themeable
*/
#}
<table{{ attributes }}>
{% if caption_needed %}
<caption>
{% if caption %}
{{ caption }}
{% else %}
{{ title }}
{% endif %}
{% if (summary is not empty) or (description is not empty) %}
<details>
{% if summary is not empty %}
<summary>{{ summary }}</summary>
{% endif %}
{% if description is not empty %}
{{ description }}
{% endif %}
</details>
{% endif %}
</caption>
Alex Pott
committed
{% endif %}
{% if header %}
<thead>
<tr>
{% for key, field in header %}
<th{{ header_classes[key] }} scope="col">
{{ field }}
</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for row_count, row in rows %}
<tr{{ row_classes[row_count] }}>
{% for field, content in row %}
<td{{ field_classes[field][row_count] }}>
{{ content }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>