function PreprocessHooks::menuLocalAction
Same name and namespace in other branches
- 11.x core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::menuLocalAction()
Implements hook_preprocess_HOOK() for menu_local_action.
Attributes
#[Hook('preprocess_menu_local_action')]
File
-
core/
themes/ admin/ src/ Hook/ PreprocessHooks.php, line 886
Class
- PreprocessHooks
- Provides preprocess implementations.
Namespace
Drupal\admin\HookCode
public function menuLocalAction(array &$variables) : void {
$variables['link']['#options']['attributes']['class'][] = 'button--primary';
$variables['attributes']['class'][] = 'local-actions__item';
$legacy_class_key = array_search('button-action', $variables['link']['#options']['attributes']['class'], TRUE);
if ($legacy_class_key !== FALSE) {
$variables['link']['#options']['attributes']['class'][$legacy_class_key] = 'button--action';
}
// Are we displaying an edit form?
if (Helper::formActions()) {
$classes =& $variables['link']['#options']['attributes']['class'];
$classes = array_filter($classes, static function ($e) {
return $e !== 'button--primary';
});
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.