function MultistepForm::submitForm
Same name in other branches
- 3.x modules/form_api_example/src/Form/MultistepForm.php \Drupal\form_api_example\Form\MultistepForm::submitForm()
- 4.0.x modules/form_api_example/src/Form/MultistepForm.php \Drupal\form_api_example\Form\MultistepForm::submitForm()
File
-
form_api_example/
src/ Form/ MultistepForm.php, line 86
Class
- MultistepForm
- Provides a form with two steps.
Namespace
Drupal\form_api_example\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$page_values = $form_state->get('page_values');
$this->messenger()
->addMessage($this->t('The form has been submitted. name="@first @last", year of birth=@year_of_birth', [
'@first' => $page_values['first_name'],
'@last' => $page_values['last_name'],
'@year_of_birth' => $page_values['birth_year'],
]));
$this->messenger()
->addMessage($this->t('And the favorite color is @color', [
'@color' => $form_state->getValue('color'),
]));
}