You are here

public function FavoriteAnimalTestForm::submitForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php \Drupal\block_test\Form\FavoriteAnimalTestForm::submitForm()
  2. 10 core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php \Drupal\block_test\Form\FavoriteAnimalTestForm::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

core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php, line 42

Class

FavoriteAnimalTestForm
Form that performs favorite animal test.

Namespace

Drupal\block_test\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->messenger()
    ->addStatus($this
    ->t('Your favorite animal is: @favorite_animal', [
    '@favorite_animal' => $form['favorite_animal']['#value'],
  ]));
}