function ViewsUiThemeHooks::preprocessViewsListingTable
Prepares variables for Views UI view listing templates.
Default template: views-ui-view-listing-table.html.twig.
Parameters
array $variables: An associative array containing:
- headers: An associative array containing the headers for the view listing table.
- rows: An associative array containing the rows data for the view listing table.
File
-
core/
modules/ views_ui/ src/ Hook/ ViewsUiThemeHooks.php, line 156
Class
- ViewsUiThemeHooks
- Hook implementations for views_ui.
Namespace
Drupal\views_ui\HookCode
public function preprocessViewsListingTable(array &$variables) : void {
// Convert the attributes to valid attribute objects.
foreach ($variables['headers'] as $key => $header) {
$variables['headers'][$key]['attributes'] = new Attribute($header['#attributes']);
}
if (!empty($variables['rows'])) {
foreach ($variables['rows'] as $key => $row) {
$variables['rows'][$key]['attributes'] = new Attribute($row['#attributes']);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.