You are here

public function Select2AutocompleteForm::buildForm in Select 2 8

Form constructor.

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 The form structure.

Overrides FormInterface::buildForm

File

tests/modules/select2_form_test/src/Form/Select2AutocompleteForm.php, line 26

Class

Select2AutocompleteForm
Test form to test the select2 element.

Namespace

Drupal\select2_form_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $customize = FALSE) {
  $form['select2_autocomplete'] = [
    '#type' => 'select2',
    '#title' => 'Autocomplete',
    '#autocomplete' => TRUE,
    '#target_type' => 'entity_test_mulrevpub',
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => 'Submit',
  ];
  return $form;
}