You are here

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

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

File

src/Element/CshsElement.php, line 78

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'],
    'noFirstLevelNone' => $element['#no_first_level_none'],
  ];
  static::setAttributes($element, [
    'simpler-select-root',
    'form-element',
    'form-element--type-select',
  ]);
  return $element;
}