You are here

public function DependentDropdown::instrumentDropdownCallback in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 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

modules/ajax_example/src/Form/DependentDropdown.php, line 191

Class

DependentDropdown
Re-populate a dropdown based on form state.

Namespace

Drupal\ajax_example\Form

Code

public function instrumentDropdownCallback(array $form, FormStateInterface $form_state) {
  return $form['instrument_fieldset_container'];
}