Version 1
[yaffs-website] / web / modules / contrib / ctools / tests / modules / ctools_wizard_test / src / Form / ExampleConfigEntityTwoForm.php
diff --git a/web/modules/contrib/ctools/tests/modules/ctools_wizard_test/src/Form/ExampleConfigEntityTwoForm.php b/web/modules/contrib/ctools/tests/modules/ctools_wizard_test/src/Form/ExampleConfigEntityTwoForm.php
new file mode 100644 (file)
index 0000000..6ea2f40
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+namespace Drupal\ctools_wizard_test\Form;
+
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Simple wizard step form.
+ */
+class ExampleConfigEntityTwoForm extends FormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'ctools_wizard_test_config_entity_two_form';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $cached_values = $form_state->getTemporaryValue('wizard');
+    /** @var $page \Drupal\ctools_wizard_test\Entity\ExampleConfigEntity */
+    $config_entity = $cached_values['ctools_wizard_test_config_entity'];
+
+    $form['two'] = array(
+      '#title' => $this->t('Two'),
+      '#type' => 'textfield',
+      '#default_value' => $config_entity->getTwo() ?: '',
+    );
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $cached_values = $form_state->getTemporaryValue('wizard');
+    /** @var $page \Drupal\ctools_wizard_test\Entity\ExampleConfigEntity */
+    $config_entity = $cached_values['ctools_wizard_test_config_entity'];
+
+    $config_entity->set('two', $form_state->getValue('two'));
+  }
+
+}