function DynamicFormSections::promptCallback
Same name in other branches
- 4.0.x modules/ajax_example/src/Form/DynamicFormSections.php \Drupal\ajax_example\Form\DynamicFormSections::promptCallback()
Callback for the select element.
Since the questions_fieldset part of the form has already been built during the AJAX request, we can return only that part of the form to the AJAX request, and it will insert that part into questions-fieldset-wrapper.
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 form structure.
File
-
modules/
ajax_example/ src/ Form/ DynamicFormSections.php, line 222
Class
- DynamicFormSections
- Dynamically-enabled form with graceful no-JS degradation.
Namespace
Drupal\ajax_example\FormCode
public function promptCallback(array $form, FormStateInterface $form_state) {
return $form['questions_fieldset'];
}