function TextForm::submitForm

Same name in other branches
  1. 3.x modules/theming_example/src/Form/TextForm.php \Drupal\theming_example\Form\TextForm::submitForm()

Overrides FormInterface::submitForm

File

modules/theming_example/src/Form/TextForm.php, line 42

Class

TextForm
A simple form that displays a textfield and submit button.

Namespace

Drupal\theming_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->messenger()
        ->addMessage($this->t('You chose %input', [
        '%input' => $form_state->getValue('text'),
    ]));
}