function Wizard::submitForm

Same name and namespace in other branches
  1. 3.x modules/ajax_example/src/Form/Wizard.php \Drupal\ajax_example\Form\Wizard::submitForm()

Save away the current information.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

modules/ajax_example/src/Form/Wizard.php, line 222

Class

Wizard
AJAX example wizard.

Namespace

Drupal\ajax_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $messenger = $this->messenger();
  $messenger->addMessage($this->t('Your information has been submitted:'));
  $messenger->addMessage($this->t('Name: @name', [
    '@name' => $form_state->getValue([
      'step1',
      'name',
    ]),
  ]));
  $messenger->addMessage($this->t('Address: @address', [
    '@address' => $form_state->getValue([
      'step2',
      'address',
    ]),
  ]));
  $messenger->addMessage($this->t('City: @city', [
    '@city' => $form_state->getValue([
      'step3',
      'city',
    ]),
  ]));
}