81120ad1459cf174dcf72a9b77625210c3de7dd5
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestDescriptionForm.php
1 <?php
2
3 namespace Drupal\form_test\Form;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Defines a form for testing form element description display options.
10  *
11  * @see \Drupal\system\Tests\Form\ElementsLabelsTest::testFormDescriptions()
12  */
13 class FormTestDescriptionForm extends FormBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function getFormId() {
19     return 'form_test_description_display';
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function buildForm(array $form, FormStateInterface $form_state) {
26     $form['form_textfield_test_description_before'] = [
27       '#type' => 'textfield',
28       '#title' => 'Textfield test for description before element',
29       '#description' => 'Textfield test for description before element',
30       '#description_display' => 'before',
31     ];
32
33     $form['form_textfield_test_description_after'] = [
34       '#type' => 'textfield',
35       '#title' => 'Textfield test for description after element',
36       '#description' => 'Textfield test for description after element',
37       '#description_display' => 'after',
38     ];
39
40     $form['form_textfield_test_description_invisible'] = [
41       '#type' => 'textfield',
42       '#title' => 'Textfield test for visually-hidden description',
43       '#description' => 'Textfield test for visually-hidden description',
44       '#description_display' => 'invisible',
45     ];
46
47     return $form;
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function submitForm(array &$form, FormStateInterface $form_state) {
54     // The test that uses this form does not submit the form so this is empty.
55   }
56
57 }