public function DependentDropdown::instrumentDropdownCallback in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/ajax_example/src/Form/DependentDropdown.php \Drupal\ajax_example\Form\DependentDropdown::instrumentDropdownCallback()
Provide a new dropdown based on the AJAX call.
This callback will occur *after* the form has been rebuilt by buildForm(). Since that's the case, the form should contain the right values for instrument_dropdown.
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 portion of the render structure that will replace the instrument-dropdown-replace form element.
File
- ajax_example/
src/ Form/ DependentDropdown.php, line 191
Class
- DependentDropdown
- Re-populate a dropdown based on form state.
Namespace
Drupal\ajax_example\FormCode
public function instrumentDropdownCallback(array $form, FormStateInterface $form_state) {
return $form['instrument_fieldset_container'];
}