c5d4cef94d53673e64c323ad81d08e4f2cc07610
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / ConfirmFormTestForm.php
1 <?php
2
3 namespace Drupal\form_test;
4
5 use Drupal\Core\Form\ConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7 use Drupal\Core\Url;
8
9 /**
10  * Provides a test confirmation form.
11  *
12  * @internal
13  */
14 class ConfirmFormTestForm extends ConfirmFormBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function getFormId() {
20     return 'form_test_confirm_test_form';
21   }
22
23   /**
24    * {@inheritdoc}
25    */
26   public function getQuestion() {
27     return $this->t('ConfirmFormTestForm::getQuestion().');
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function getCancelUrl() {
34     return new Url('form_test.route8');
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   public function getDescription() {
41     return $this->t('ConfirmFormTestForm::getDescription().');
42   }
43
44   /**
45    * {@inheritdoc}
46    */
47   public function getConfirmText() {
48     return $this->t('ConfirmFormTestForm::getConfirmText().');
49   }
50
51   /**
52    * {@inheritdoc}
53    */
54   public function getCancelText() {
55     return $this->t('ConfirmFormTestForm::getCancelText().');
56   }
57
58   /**
59    * {@inheritdoc}
60    */
61   public function buildForm(array $form, FormStateInterface $form_state) {
62     $form['element'] = ['#markup' => '<p>The ConfirmFormTestForm::buildForm() method was used for this form.</p>'];
63
64     return parent::buildForm($form, $form_state);
65   }
66
67   /**
68    * {@inheritdoc}
69    */
70   public function submitForm(array &$form, FormStateInterface $form_state) {
71     drupal_set_message($this->t('The ConfirmFormTestForm::submitForm() method was used for this form.'));
72     $form_state->setRedirect('<front>');
73   }
74
75 }