function TreeConfigTargetForm::updateOptions
Same name in other branches
- 11.x core/modules/system/tests/modules/form_test/src/Form/TreeConfigTargetForm.php \Drupal\form_test\Form\TreeConfigTargetForm::updateOptions()
Updates the options of a select list.
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 updated form element.
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ TreeConfigTargetForm.php, line 82
Class
Namespace
Drupal\form_test\FormCode
public function updateOptions(array $form, FormStateInterface $form_state) {
$form['test1']['#options']['option1'] = $this->t('Option 1!!!');
$form['test1']['#options'] += [
'option3' => $this->t('Option 3'),
'option4' => $this->t('Option 4'),
];
return $form['test1'];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.