You are here

function claro_preprocess_menu_local_task in Drupal 10

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

Implements hook_preprocess_HOOK() for menu-local-task templates.

File

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

Code

function claro_preprocess_menu_local_task(&$variables) {
  $variables['link']['#options']['attributes']['class'][] = 'tabs__link';
  $variables['link']['#options']['attributes']['class'][] = 'js-tabs-link';

  // Ensure is-active class is set when the tab is active. The generic active
  // link handler applies stricter comparison rules than what is necessary for
  // tabs.
  if (isset($variables['is_active']) && $variables['is_active'] === TRUE) {
    $variables['link']['#options']['attributes']['class'][] = 'is-active';
  }
  if (isset($variables['element']['#level'])) {
    $variables['level'] = $variables['element']['#level'];
  }
}