function olivero_preprocess_table in Drupal 10
Same name and namespace in other branches
- 9 core/themes/olivero/olivero.theme \olivero_preprocess_table()
Implements hook_preprocess_table().
File
- core/
themes/ olivero/ olivero.theme, line 594 - Functions to support theming in the Olivero theme.
Code
function olivero_preprocess_table(&$variables) {
// Mark the whole table and the first cells if rows are draggable.
if (!empty($variables['rows'])) {
$draggable_row_found = FALSE;
foreach ($variables['rows'] as &$row) {
/** @var \Drupal\Core\Template\Attribute $row['attributes'] */
if (!empty($row['attributes']) && $row['attributes']
->hasClass('draggable')) {
if (!$draggable_row_found) {
$variables['attributes']['class'][] = 'draggable-table';
$draggable_row_found = TRUE;
}
}
}
}
}