public function BuildDemo::ajaxSubmit in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/form_api_example/src/Form/BuildDemo.php \Drupal\form_api_example\Form\BuildDemo::ajaxSubmit()
Implements ajax submit callback.
Parameters
array $form: Form render array.
\Drupal\Core\Form\FormStateInterface $form_state: Current state of the form.
File
- form_api_example/
src/ Form/ BuildDemo.php, line 136
Class
- BuildDemo
- Implements the build demo form controller.
Namespace
Drupal\form_api_example\FormCode
public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
$this
->displayMethodInvocation('ajaxSubmit');
$form['messages']['status'] = [
'#type' => 'status_messages',
];
return $form['messages'];
}