You are here

function claro_preprocess_links__dropbutton in Drupal 9

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

Implements hook_preprocess_HOOK() for links__dropbutton.

File

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

Code

function claro_preprocess_links__dropbutton(&$variables) {

  // Add the right CSS class for the dropbutton list that helps reducing FOUC.
  if (!empty($variables['links'])) {
    $variables['attributes']['class'][] = count($variables['links']) > 1 ? 'dropbutton--multiple' : 'dropbutton--single';
  }
  foreach ($variables['links'] as &$link_data) {
    $link_data['attributes']
      ->addClass('dropbutton__item');
  }
}