function ClaroPreRender::dropButton

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\claro

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.