diff --git a/lib/tablelib.php b/lib/tablelib.php index b9b593a7ffa..7aab424dc6b 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -1143,6 +1143,12 @@ class flexible_table { foreach ($row as $index => $data) { $column = $colbyindex[$index]; + $columnattributes = $this->columnsattributes[$column] ?? []; + if (isset($columnattributes['class'])) { + $this->column_class($column, $columnattributes['class']); + unset($columnattributes['class']); + } + $attributes = [ 'class' => "cell c{$index}" . $this->column_class[$column], 'id' => "{$rowid}_c{$index}", @@ -1155,7 +1161,7 @@ class flexible_table { $attributes['scope'] = 'row'; } - $attributes += $this->columnsattributes[$column] ?? []; + $attributes += $columnattributes; if (empty($this->prefs['collapse'][$column])) { if ($this->column_suppress[$column] && $suppresslastrow !== null && $suppresslastrow[$index] === $data) { diff --git a/lib/upgrade.txt b/lib/upgrade.txt index f790a3bd2a8..2ada5efa520 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -72,6 +72,7 @@ information provided here is intended especially for developers. * The core/modal module and all their versions (SAVE_CANCEL, DELETE_CANCEL...) now has a setButtonDisable to disable or enable specific modal action buttons. This function allows developers to have modals that could only be submited if the user do some action in the modal body like ticking a checkbox or selecting an element. +* The method `flexible_table::set_columnsattributes` now can be used with 'class' key to add custom classes to the DOM. === 4.1 ===