public static function ClaroPreRender::dropButton in Drupal 8
Prerender callback for Dropbutton element.
@todo Revisit after https://www.drupal.org/node/3057581 is added.
File
- core/
themes/ claro/ src/ ClaroPreRender.php, line 117
Class
- ClaroPreRender
- Implements trusted prerender callbacks for the Claro theme.
Namespace
Drupal\claroCode
public static function dropButton($element) {
if (!empty($element['#dropbutton_type']) && is_string($element['#dropbutton_type'])) {
$supported_types = [
'small',
'extrasmall',
];
if (in_array($element['#dropbutton_type'], $supported_types)) {
$element['#attributes']['class'][] = 'dropbutton--' . $element['#dropbutton_type'];
}
}
return $element;
}