1829ab25662be1059e793c19e2d75328a457ed82
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestValidateRequiredNoTitleForm.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  * Form constructor to test the #required property without #title.
10  *
11  * @internal
12  */
13 class FormTestValidateRequiredNoTitleForm extends FormBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function getFormId() {
19     return 'form_test_validate_required_form_no_title';
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function buildForm(array $form, FormStateInterface $form_state) {
26     $form['textfield'] = [
27       '#type' => 'textfield',
28       '#required' => TRUE,
29     ];
30     $form['actions'] = ['#type' => 'actions'];
31     $form['actions']['submit'] = ['#type' => 'submit', '#value' => 'Submit'];
32     return $form;
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function submitForm(array &$form, FormStateInterface $form_state) {
39     drupal_set_message('The form_test_validate_required_form_no_title form was submitted successfully.');
40   }
41
42 }