1e996eea3b13f3e5bb0456b0b9fb69cb887f3118
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestValidateNoToken.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 to test the validation of forms with a disabled CSRF token.
10  */
11 class FormTestValidateNoToken extends FormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'form_test_validate_no_token';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state) {
24     $form['#token'] = FALSE;
25     $form['submit'] = [
26       '#type' => 'submit',
27       '#value' => 'Save',
28     ];
29     return $form;
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   public function submitForm(array &$form, FormStateInterface $form_state) {
36     drupal_set_message('The form_test_validate_no_token form has been submitted successfully.');
37   }
38
39 }