bf250ac4524f68193ce84a5d48438302aa19e979
[yaffs-website] / web / core / modules / system / tests / modules / session_test / src / Form / SessionTestForm.php
1 <?php
2
3 namespace Drupal\session_test\Form;
4
5 use Drupal\Component\Utility\SafeMarkup;
6 use Drupal\Core\Form\FormBase;
7 use Drupal\Core\Form\FormStateInterface;
8
9 /**
10  * Form controller for the test config edit forms.
11  */
12 class SessionTestForm extends FormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getFormId() {
18     return 'session_test_form';
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function buildForm(array $form, FormStateInterface $form_state) {
25     $form['input'] = [
26       '#type' => 'textfield',
27       '#title' => 'Input',
28       '#required' => TRUE,
29     ];
30
31     $form['actions'] = ['#type' => 'actions'];
32     $form['actions']['submit'] = [
33       '#type' => 'submit',
34       '#value' => 'Save',
35     ];
36
37     return $form;
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function submitForm(array &$form, FormStateInterface $form_state) {
44     drupal_set_message(SafeMarkup::format('Ok: @input', ['@input' => $form_state->getValue('input')]));
45   }
46
47 }