Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / block / tests / modules / block_test / src / Form / FavoriteAnimalTestForm.php
1 <?php
2
3 namespace Drupal\block_test\Form;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 class FavoriteAnimalTestForm extends FormBase {
9
10   /**
11    * {@inheritdoc}
12    */
13   public function getFormId() {
14     return 'block_test_form_favorite_animal_test';
15   }
16
17   /**
18    * {@inheritdoc}
19    */
20   public function buildForm(array $form, FormStateInterface $form_state) {
21     $form['favorite_animal'] = [
22       '#type' => 'textfield',
23       '#title' => $this->t('Your favorite animal.')
24     ];
25
26     $form['submit_animal'] = [
27       '#type' => 'submit',
28       '#value' => $this->t('Submit your chosen animal'),
29     ];
30
31     return $form;
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function submitForm(array &$form, FormStateInterface $form_state) {
38     drupal_set_message($this->t('Your favorite animal is: @favorite_animal', ['@favorite_animal' => $form['favorite_animal']['#value']]));
39   }
40
41 }