function TextForm::submitForm

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

Form submission handler.

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/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'),
    ]));
}