Commit 1c7cf179 authored by alexpott's avatar alexpott

Issue #806982 by lokapujya, gnuget, miqmago, shashi1028, Floydm, bfroehle,...

Issue #806982 by lokapujya, gnuget, miqmago, shashi1028, Floydm, bfroehle, kathyh, sreynen: Tables should take an optional footer variable and produce <tfoot>.
parent 135ca1c0
This diff is collapsed.
......@@ -110,6 +110,28 @@ function testThemeTableWithNoStriping() {
$this->assertNoRaw('no_striping', 'No invalid no_striping HTML attribute was printed.');
}
/**
* Test that the 'footer' option works correctly.
*/
function testThemeTableFooter() {
$footer = array(
array(
'data' => array(1),
),
array('Foo'),
);
$table = array(
'#type' => 'table',
'#rows' => array(),
'#footer' => $footer,
);
$this->render($table);
$this->removeWhiteSpace();
$this->assertRaw('<tfoot><tr><td>1</td></tr><tr><td>Foo</td></tr></tfoot>', 'Table footer found.');
}
/**
* Tests that the 'header' option in cells works correctly.
*/
......
......@@ -28,6 +28,7 @@
* - attributes: Any HTML attributes, such as "colspan", to apply to the
* table cell.
* - content: The string to display in the table cell.
* - 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.
*
......@@ -78,4 +79,17 @@
{% endfor %}
</tbody>
{% endif %}
{% if footer %}
<tfoot>
{% for row in footer %}
<tr{{ row.attributes }}>
{% for cell in row.cells %}
<{{ cell.tag }}{{ cell.attributes }}>
{{- cell.content -}}
</{{ cell.tag }}>
{% endfor %}
</tr>
{% endfor %}
</tfoot>
{% endif %}
</table>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment