5c3decd17f3770bd2538b00ba44a04a0cc918b8e
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestGetForm.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 whether GET forms have a CSRF token.
10  */
11 class FormTestGetForm extends FormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'form_test_get_form';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state) {
24     $form['#method'] = 'get';
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_get_form form has been submitted successfully.');
37   }
38
39 }