Version 1
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestPlaceholderForm.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 placeholder attribute.
10  */
11 class FormTestPlaceholderForm extends FormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'form_test_placeholder_test';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state) {
24     foreach (['textfield', 'textarea', 'url', 'password', 'search', 'tel', 'email', 'number'] as $type) {
25       $form[$type] = [
26         '#type' => $type,
27         '#title' => $type,
28         '#placeholder' => 'placeholder-text',
29       ];
30     }
31
32     return $form;
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function submitForm(array &$form, FormStateInterface $form_state) {
39   }
40
41 }