You are here

public static function CshsElement::processElement in Client-side Hierarchical Select 8

Same name and namespace in other branches
  1. 8.3 src/Element/CshsElement.php \Drupal\cshs\Element\CshsElement::processElement()
  2. 8.2 src/Element/CshsElement.php \Drupal\cshs\Element\CshsElement::processElement()

File

src/Element/CshsElement.php, line 54

Class

CshsElement
Defines the CSHS element.

Namespace

Drupal\cshs\Element

Code

public static function processElement(array $element) : array {
  \assert(Inspector::assertAllStringable($element['#labels']));
  $element['#attached']['library'][] = 'cshs/cshs.base';
  $element['#attached']['drupalSettings'][static::ID][$element['#id']] = [
    'labels' => $element['#labels'],
    'noneLabel' => $element['#none_label'],
    'noneValue' => $element['#none_value'],
  ];
  static::setAttributes($element, [
    'simpler-select-root',
    'form-element',
    'form-element--type-select',
  ]);
  return $element;
}