function ClaroHooks::preprocessLinksDropbutton
Same name and namespace in other branches
- main core/themes/claro/src/Hook/ClaroHooks.php \Drupal\claro\Hook\ClaroHooks::preprocessLinksDropbutton()
Implements hook_preprocess_HOOK() for links__dropbutton.
Attributes
#[Hook('preprocess_links__dropbutton')]
File
-
core/
themes/ claro/ src/ Hook/ ClaroHooks.php, line 1000
Class
- ClaroHooks
- Hook implementations for claro.
Namespace
Drupal\claro\HookCode
public function preprocessLinksDropbutton(&$variables) : void {
// 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');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.