function ConfigFormBase::submitForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase::submitForm()
  2. 8.9.x core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase::submitForm()
  3. 11.x core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase::submitForm()

Overrides FormInterface::submitForm

18 calls to ConfigFormBase::submitForm()
AdvancedSettingsForm::submitForm in core/modules/views_ui/src/Form/AdvancedSettingsForm.php
Form submission handler.
ForumSettingsForm::submitForm in core/modules/forum/src/ForumSettingsForm.php
Form submission handler.
ImageToolkitForm::submitForm in core/modules/system/src/Form/ImageToolkitForm.php
Form submission handler.
LocaleSettingsForm::submitForm in core/modules/locale/src/Form/LocaleSettingsForm.php
Form submission handler.
MenuLinksetSettingsForm::submitForm in core/modules/system/src/Form/MenuLinksetSettingsForm.php
Form submission handler.

... See full list

24 methods override ConfigFormBase::submitForm()
AdvancedSettingsForm::submitForm in core/modules/views_ui/src/Form/AdvancedSettingsForm.php
Form submission handler.
FormTestArgumentsObject::submitForm in core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php
Form submission handler.
FormTestControllerObject::submitForm in core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php
Form submission handler.
FormTestObject::submitForm in core/modules/system/tests/modules/form_test/src/FormTestObject.php
Form submission handler.
FormTestServiceObject::submitForm in core/modules/system/tests/modules/form_test/src/FormTestServiceObject.php
Form submission handler.

... See full list

File

core/lib/Drupal/Core/Form/ConfigFormBase.php, line 303

Class

ConfigFormBase
Base class for implementing system configuration forms.

Namespace

Drupal\Core\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $map = $form_state->get(static::CONFIG_KEY_TO_FORM_ELEMENT_MAP) ?? [];
    foreach (array_keys($map) as $config_name) {
        $config = $this->configFactory()
            ->getEditable($config_name);
        static::copyFormValuesToConfig($config, $form_state, $form);
        $config->save();
    }
    $this->messenger()
        ->addStatus($this->t('The configuration options have been saved.'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.