You are here

public function Select2::getInfo in Select 2 8

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/Select2.php, line 104

Class

Select2
Provides an select2 form element.

Namespace

Drupal\select2\Element

Code

public function getInfo() {
  $info = parent::getInfo();
  $class = get_class($this);

  // Apply default form element properties.
  $info['#target_type'] = NULL;
  $info['#selection_handler'] = 'default';
  $info['#selection_settings'] = [];
  $info['#autocomplete'] = FALSE;
  $info['#autocreate'] = [];
  $info['#empty_value'] = '';
  $info['#cardinality'] = 0;
  $info['#pre_render'][] = [
    $class,
    'preRenderAutocomplete',
  ];
  $info['#pre_render'][] = [
    $class,
    'preRenderOverwrites',
  ];
  $info['#element_validate'][] = [
    $class,
    'validateEntityAutocomplete',
  ];
  $info['#select2'] = [];
  return $info;
}