Version 1
[yaffs-website] / web / core / modules / system / tests / modules / session_test / src / Form / SessionTestForm.php
diff --git a/web/core/modules/system/tests/modules/session_test/src/Form/SessionTestForm.php b/web/core/modules/system/tests/modules/session_test/src/Form/SessionTestForm.php
new file mode 100644 (file)
index 0000000..bf250ac
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+namespace Drupal\session_test\Form;
+
+use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Form controller for the test config edit forms.
+ */
+class SessionTestForm extends FormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'session_test_form';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $form['input'] = [
+      '#type' => 'textfield',
+      '#title' => 'Input',
+      '#required' => TRUE,
+    ];
+
+    $form['actions'] = ['#type' => 'actions'];
+    $form['actions']['submit'] = [
+      '#type' => 'submit',
+      '#value' => 'Save',
+    ];
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    drupal_set_message(SafeMarkup::format('Ok: @input', ['@input' => $form_state->getValue('input')]));
+  }
+
+}