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