public function Callbacks::selectCallback in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::selectCallback()
- 9 core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::selectCallback()
Ajax callback triggered by select.
File
- core/
modules/ system/ tests/ modules/ ajax_forms_test/ src/ Callbacks.php, line 18
Class
- Callbacks
- Simple object for testing methods as Ajax callbacks.
Namespace
Drupal\ajax_forms_testCode
public function selectCallback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response
->addCommand(new HtmlCommand('#ajax_selected_color', $form_state
->getValue('select')));
$response
->addCommand(new DataCommand('#ajax_selected_color', 'form_state_value_select', $form_state
->getValue('select')));
return $response;
}