public function ChosenTestForm::buildForm in Chosen 3.0.x
Same name and namespace in other branches
- 8.2 tests/modules/chosen_test/src/Form/ChosenTestForm.php \Drupal\chosen_test\Form\ChosenTestForm::buildForm()
Chosen test form.
Overrides FormInterface::buildForm
File
- tests/
modules/ chosen_test/ src/ Form/ ChosenTestForm.php, line 26
Class
- ChosenTestForm
- Implements a ChosenConfig form.
Namespace
Drupal\chosen_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['select'] = [
'#type' => 'select',
'#required' => FALSE,
'#title' => $this
->t('Select'),
'#default_value' => '',
'#empty_option' => $this
->t('- Select -'),
'#options' => [
'Option 1',
'Option 2',
'Option 3',
'Option 4',
],
'#chosen' => 1,
];
return $form;
}