diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index d10ce95..496a163 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1244,7 +1244,6 @@ function template_preprocess_table(&$variables) {
$variables['rows'][] = array(array(
'data' => $variables['empty'],
'colspan' => $header_count,
- 'class' => array('empty', 'message'),
));
}
@@ -1311,17 +1310,14 @@ function template_preprocess_table(&$variables) {
$sections = array('rows' , 'footer');
foreach ($sections as $section) {
if (!empty($variables[$section])) {
- $flip = array('even' => 'odd', 'odd' => 'even');
- $class = 'even';
foreach ($variables[$section] as $row_key => $row) {
$cells = $row;
$row_attributes = array();
- $no_striping = $section === 'footer';
// Check if we're dealing with a simple or complex row
if (isset($row['data'])) {
$cells = $row['data'];
- $no_striping = isset($row['no_striping']) ? $row['no_striping'] : $no_striping;
+ $variables['no_striping'] = isset($row['no_striping']) ? $row['no_striping'] : FALSE;
// Set the attributes array and exclude 'data' and 'no_striping'.
$row_attributes = $row;
@@ -1329,13 +1325,6 @@ function template_preprocess_table(&$variables) {
unset($row_attributes['no_striping']);
}
- // Add odd/even class.
- if (!$no_striping) {
- $class = $flip[$class];
- $row_attributes['class'][] = $class;
- }
-
-
// Build row.
$variables[$section][$row_key] = array();
$variables[$section][$row_key]['attributes'] = new Attribute($row_attributes);
@@ -1371,7 +1360,7 @@ function template_preprocess_table(&$variables) {
}
// Add active class if needed for sortable tables.
if (isset($variables['header'][$col_key]['data']) && $variables['header'][$col_key]['data'] == $ts['name'] && !empty($variables['header'][$col_key]['field'])) {
- $cell_attributes['class'][] = 'active';
+ $variables[$section][$row_key]['cells'][$col_key]['table_sort'] = TRUE;
}
// Copy RESPONSIVE_PRIORITY_LOW/RESPONSIVE_PRIORITY_MEDIUM
// class from header to cell as needed.
diff --git a/core/modules/system/templates/table.html.twig b/core/modules/system/templates/table.html.twig
index 9c1cb05..7972721 100644
--- a/core/modules/system/templates/table.html.twig
+++ b/core/modules/system/templates/table.html.twig
@@ -28,9 +28,11 @@
* - attributes: Any HTML attributes, such as "colspan", to apply to the
* table cell.
* - content: The string to display in the table cell.
+ * - active: A boolean indicating whether the cell is active.
* - 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.
*
* @see template_preprocess_table()
*
@@ -58,7 +60,12 @@
{% for cell in header %}
- <{{ cell.tag }}{{ cell.attributes }}>
+ {%
+ set cell_classes = [
+ cell.table_sort ? 'active',
+ ]
+ %}
+ <{{ cell.tag }}{{ cell.attributes.addClass(cell_classes) }}>
{{- cell.content -}}
{{ cell.tag }}>
{% endfor %}
@@ -69,9 +76,20 @@
{% if rows %}