You are here

public function Select::form in YAML Form 8

Gets the actual configuration form array to be built.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array An associative array contain the element's configuration form without any default values..

Overrides OptionsBase::form

File

src/Plugin/YamlFormElement/Select.php, line 61

Class

Select
Provides a 'select' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['options']['select2'] = [
    '#title' => $this
      ->t('Select2'),
    '#type' => 'checkbox',
    '#return_value' => TRUE,
    '#description' => $this
      ->t('Replace select element with jQuery <a href=":href">Select2</a> box.', [
      ':href' => 'https://select2.github.io/',
    ]),
  ];
  return $form;
}