You are here

function claro_preprocess_views_view_table in Drupal 9

Same name and namespace in other branches
  1. 8 core/themes/claro/claro.theme \claro_preprocess_views_view_table()
  2. 10 core/themes/claro/claro.theme \claro_preprocess_views_view_table()

Implements template_preprocess_HOOK() for views_view_table.

@todo Revisit after https://www.drupal.org/node/3025726 or https://www.drupal.org/node/1973418 is in.

File

core/themes/claro/claro.theme, line 1045
Functions to support theming in the Claro theme.

Code

function claro_preprocess_views_view_table(&$variables) {
  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']) && isset($query['sort'])) {
          $header_cell['attributes']
            ->addClass('sortable-heading');
        }
      }
    }
  }
}