function AjaxFormBlock::updateOptions
Same name in other branches
- 9 core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php \Drupal\ajax_forms_test\Plugin\Block\AjaxFormBlock::updateOptions()
- 8.9.x core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php \Drupal\ajax_forms_test\Plugin\Block\AjaxFormBlock::updateOptions()
- 10 core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php \Drupal\ajax_forms_test\Plugin\Block\AjaxFormBlock::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/ ajax_forms_test/ src/ Plugin/ Block/ AjaxFormBlock.php, line 128
Class
- AjaxFormBlock
- Provides an AJAX form block.
Namespace
Drupal\ajax_forms_test\Plugin\BlockCode
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.