917f9e0ef6d471dc3b719026a74176faaaa70cf8
[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 class ConfirmFormTestForm extends ConfirmFormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getFormId() {
18     return 'form_test_confirm_test_form';
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getQuestion() {
25     return $this->t('ConfirmFormTestForm::getQuestion().');
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function getCancelUrl() {
32     return new Url('form_test.route8');
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function getDescription() {
39     return $this->t('ConfirmFormTestForm::getDescription().');
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function getConfirmText() {
46     return $this->t('ConfirmFormTestForm::getConfirmText().');
47   }
48
49   /**
50    * {@inheritdoc}
51    */
52   public function getCancelText() {
53     return $this->t('ConfirmFormTestForm::getCancelText().');
54   }
55
56   /**
57    * {@inheritdoc}
58    */
59   public function buildForm(array $form, FormStateInterface $form_state) {
60     $form['element'] = ['#markup' => '<p>The ConfirmFormTestForm::buildForm() method was used for this form.</p>'];
61
62     return parent::buildForm($form, $form_state);
63   }
64
65   /**
66    * {@inheritdoc}
67    */
68   public function submitForm(array &$form, FormStateInterface $form_state) {
69     drupal_set_message($this->t('The ConfirmFormTestForm::submitForm() method was used for this form.'));
70     $form_state->setRedirect('<front>');
71   }
72
73 }