b0aa1b00b7e6a2d707a64bf3659d6c2bb3cff4d5
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestRequiredAttributeForm.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  * Builds a form to test the required attribute.
10  */
11 class FormTestRequiredAttributeForm extends FormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'form_test_required_attribute';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state) {
24     foreach (['textfield', 'textarea', 'password'] as $type) {
25       $form[$type] = [
26         '#type' => $type,
27         '#required' => TRUE,
28         '#title' => $type,
29       ];
30     }
31     $form['submit'] = [
32       '#type' => 'submit',
33       '#value' => 'Submit',
34     ];
35     return $form;
36   }
37
38   /**
39    * {@inheritdoc}
40    */
41   public function submitForm(array &$form, FormStateInterface $form_state) {
42   }
43
44 }