function FavoriteAnimalTestForm::submitForm

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.