function UpdateSettingsForm::submitForm

Same name in other branches
  1. 8.9.x core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::submitForm()
  2. 10 core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::submitForm()
  3. 11.x core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::submitForm()

Overrides ConfigFormBase::submitForm

File

core/modules/update/src/UpdateSettingsForm.php, line 152

Class

UpdateSettingsForm
Configure update settings for this site.

Namespace

Drupal\update

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $config = $this->config('update.settings');
    // See if the update_check_disabled setting is being changed, and if so,
    // invalidate all update status data.
    if ($form_state->getValue('update_check_disabled') != $config->get('check.disabled_extensions')) {
        update_storage_clear();
    }
    $config->set('check.disabled_extensions', $form_state->getValue('update_check_disabled'))
        ->set('check.interval_days', $form_state->getValue('update_check_frequency'))
        ->set('notification.emails', $form_state->get('notify_emails'))
        ->set('notification.threshold', $form_state->getValue('update_notification_threshold'))
        ->save();
    parent::submitForm($form, $form_state);
}

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