Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / templates / Form.html.twig
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\{{ module }}\Form\{{ class }}.
6  */
7
8 namespace Drupal\{{ module }}\Form;
9
10 use Drupal\Core\Form\{% if config %}Config{% endif %}FormBase;
11 use Drupal\Core\Form\FormStateInterface;
12 use Drupal\Core\Render\Element;
13
14 class {{ class }} extends {% if config %}Config{% endif %}FormBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function getFormId() {
20     return '{{ form_id }}';
21   }
22
23   {% if config %}
24   /**
25    * {@inheritdoc}
26    */
27   public function submitForm(array &$form, FormStateInterface $form_state) {
28     $config = $this->config('{{ module }}.settings');
29
30     foreach (Element::children($form) as $variable) {
31       $config->set($variable, $form_state->getValue($form[$variable]['#parents']));
32     }
33     $config->save();
34
35     if (method_exists($this, '_submitForm')) {
36       $this->_submitForm($form, $form_state);
37     }
38
39     parent::submitForm($form, $form_state);
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   protected function getEditableConfigNames() {
46     return ['{{ module }}.settings'];
47   }
48   {% endif %}
49
50 }
51 ?>