function claro_preprocess_views_view_table

Same name in other branches
  1. 8.9.x core/themes/claro/claro.theme \claro_preprocess_views_view_table()
  2. 10 core/themes/claro/claro.theme \claro_preprocess_views_view_table()
  3. 11.x 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 1065

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.