Chris@0: {#
Chris@0: /**
Chris@0: * @file
Chris@0: * Theme override to display a table.
Chris@0: *
Chris@0: * Available variables:
Chris@0: * - attributes: HTML attributes to apply to the
tag.
Chris@0: * - caption: A localized string for the tag.
Chris@0: * - colgroups: Column groups. Each group contains the following properties:
Chris@0: * - attributes: HTML attributes to apply to the tag.
Chris@0: * Note: Drupal currently supports only one table header row, see
Chris@0: * https://www.drupal.org/node/893530 and
Chris@0: * http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_table/7#comment-5109.
Chris@0: * - header: Table header cells. Each cell contains the following properties:
Chris@0: * - tag: The HTML tag name to use; either 'th' or 'td'.
Chris@0: * - attributes: HTML attributes to apply to the tag.
Chris@0: * - content: A localized string for the title of the column.
Chris@0: * - field: Field name (required for column sorting).
Chris@0: * - sort: Default sort order for this column ("asc" or "desc").
Chris@0: * - sticky: A flag indicating whether to use a "sticky" table header.
Chris@0: * - rows: Table rows. Each row contains the following properties:
Chris@0: * - attributes: HTML attributes to apply to the tag.
Chris@0: * - data: Table cells.
Chris@0: * - no_striping: A flag indicating that the row should receive no
Chris@0: * 'even / odd' styling. Defaults to FALSE.
Chris@0: * - cells: Table cells of the row. Each cell contains the following keys:
Chris@0: * - tag: The HTML tag name to use; either 'th' or 'td'.
Chris@0: * - attributes: Any HTML attributes, such as "colspan", to apply to the
Chris@0: * table cell.
Chris@0: * - content: The string to display in the table cell.
Chris@0: * - active_table_sort: A boolean indicating whether the cell is the active
Chris@0: table sort.
Chris@0: * - footer: Table footer rows, in the same format as the rows variable.
Chris@0: * - empty: The message to display in an extra row if table does not have
Chris@0: * any rows.
Chris@0: * - no_striping: A boolean indicating that the row should receive no striping.
Chris@0: * - header_columns: The number of columns in the header.
Chris@0: *
Chris@0: * @see template_preprocess_table()
Chris@0: */
Chris@0: #}
Chris@0:
Chris@0: {% if caption %}
Chris@0: {{ caption }}
Chris@0: {% endif %}
Chris@0:
Chris@0: {% for colgroup in colgroups %}
Chris@0: {% if colgroup.cols %}
Chris@0:
Chris@0: {% for col in colgroup.cols %}
Chris@0:
Chris@0: {% endfor %}
Chris@0:
Chris@0: {% else %}
Chris@0:
Chris@0: {% endif %}
Chris@0: {% endfor %}
Chris@0:
Chris@0: {% if header %}
Chris@0:
Chris@0:
Chris@0: {% for cell in header %}
Chris@0: {%
Chris@0: set cell_classes = [
Chris@0: cell.active_table_sort ? 'is-active',
Chris@0: ]
Chris@0: %}
Chris@0: <{{ cell.tag }}{{ cell.attributes.addClass(cell_classes) }}>
Chris@0: {{- cell.content -}}
Chris@0: {{ cell.tag }}>
Chris@0: {% endfor %}
Chris@0:
Chris@0:
Chris@0: {% endif %}
Chris@0:
Chris@0: {% if rows %}
Chris@0:
Chris@0: {% for row in rows %}
Chris@0: {%
Chris@0: set row_classes = [
Chris@0: not no_striping ? cycle(['odd', 'even'], loop.index0),
Chris@0: ]
Chris@0: %}
Chris@0:
Chris@0: {% for cell in row.cells %}
Chris@0: <{{ cell.tag }}{{ cell.attributes }}>
Chris@0: {{- cell.content -}}
Chris@0: {{ cell.tag }}>
Chris@0: {% endfor %}
Chris@0:
Chris@0: {% endfor %}
Chris@0:
Chris@0: {% elseif empty %}
Chris@0:
Chris@0:
Chris@0: {{ empty }} |
Chris@0:
Chris@0:
Chris@0: {% endif %}
Chris@0: {% if footer %}
Chris@0:
Chris@0: {% for row in footer %}
Chris@0:
Chris@0: {% for cell in row.cells %}
Chris@0: <{{ cell.tag }}{{ cell.attributes }}>
Chris@0: {{- cell.content -}}
Chris@0: {{ cell.tag }}>
Chris@0: {% endfor %}
Chris@0:
Chris@0: {% endfor %}
Chris@0:
Chris@0: {% endif %}
Chris@0: