function BuildDemo::ajaxSubmit

Same name in other branches
  1. 4.0.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

modules/form_api_example/src/Form/BuildDemo.php, line 136

Class

BuildDemo
Implements the build demo form controller.

Namespace

Drupal\form_api_example\Form

Code

public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
    $this->displayMethodInvocation('ajaxSubmit');
    $form['messages']['status'] = [
        '#type' => 'status_messages',
    ];
    return $form['messages'];
}