You are here

function template_preprocess_views_ui_views_listing_table in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views_ui/views_ui.theme.inc \template_preprocess_views_ui_views_listing_table()
  2. 9 core/modules/views_ui/views_ui.theme.inc \template_preprocess_views_ui_views_listing_table()

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/views_ui.theme.inc, line 58
Preprocessors and theme functions for the Views UI.

Code

function template_preprocess_views_ui_views_listing_table(&$variables) {

  // 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']);
    }
  }
}