function PreprocessHooks::viewsViewTable
Same name and namespace in other branches
- 11.x core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::viewsViewTable()
Implements hook_preprocess_HOOK() for views_view_table.
@todo Revisit after https://www.drupal.org/node/3025726 or https://www.drupal.org/node/1973418 is in.
Attributes
#[Hook('preprocess_views_view_table')]
File
-
core/
themes/ admin/ src/ Hook/ PreprocessHooks.php, line 1425
Class
- PreprocessHooks
- Provides preprocess implementations.
Namespace
Drupal\admin\HookCode
public function viewsViewTable(array &$variables) : void {
if (!empty($variables['header'])) {
foreach ($variables['header'] as &$header_cell) {
if (!empty($header_cell['url'])) {
$parsed_url = UrlHelper::parse($header_cell['url']);
$query = !empty($parsed_url['query']) ? $parsed_url['query'] : [];
if (isset($query['order'], $query['sort'])) {
$header_cell['attributes']->addClass('sortable-heading');
}
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.