Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / templates / Form.html.twig
diff --git a/web/modules/contrib/drupalmoduleupgrader/templates/Form.html.twig b/web/modules/contrib/drupalmoduleupgrader/templates/Form.html.twig
new file mode 100644 (file)
index 0000000..86746eb
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\{{ module }}\Form\{{ class }}.
+ */
+
+namespace Drupal\{{ module }}\Form;
+
+use Drupal\Core\Form\{% if config %}Config{% endif %}FormBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\Element;
+
+class {{ class }} extends {% if config %}Config{% endif %}FormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return '{{ form_id }}';
+  }
+
+  {% if config %}
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $config = $this->config('{{ module }}.settings');
+
+    foreach (Element::children($form) as $variable) {
+      $config->set($variable, $form_state->getValue($form[$variable]['#parents']));
+    }
+    $config->save();
+
+    if (method_exists($this, '_submitForm')) {
+      $this->_submitForm($form, $form_state);
+    }
+
+    parent::submitForm($form, $form_state);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getEditableConfigNames() {
+    return ['{{ module }}.settings'];
+  }
+  {% endif %}
+
+}
+?>