You are here

public function CshsElement::getInfo in Client-side Hierarchical Select 8.3

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

Returns the element properties for this element.

Return value

array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format.

Overrides Select::getInfo

File

src/Element/CshsElement.php, line 26

Class

CshsElement
Defines the CSHS element.

Namespace

Drupal\cshs\Element

Code

public function getInfo() : array {
  $info = parent::getInfo();
  $info['#label'] = '';
  $info['#labels'] = [];

  // Works only with taxonomies and cannot be used if `#options` are
  // non-term values.
  $info['#force_deepest'] = FALSE;

  // Works only with taxonomies and cannot be used if `#options` are
  // non-term values.
  $info['#required_depth'] = 0;
  $info['#none_value'] = static::NONE_VALUE;

  // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString
  $info['#none_label'] = $this
    ->t(static::NONE_LABEL);

  // Do no add the `<option value="#none_value">#none_label</option>`
  // to the first level selection.
  $info['#no_first_level_none'] = FALSE;
  $info['#theme'] = static::ID;
  $info['#process'][] = [
    static::class,
    'processElement',
  ];
  $info['#pre_render'][] = [
    static::class,
    'preRender',
  ];
  $info['#element_validate'][] = [
    static::class,
    'validateElement',
  ];
  return $info;
}