UpdateSettingsForm::submitForm

public UpdateSettingsForm::submitForm(array &$form, FormStateInterface $form_state)

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

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

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);
}
doc_Drupal
2016-10-29 09:51:18
Comments
Leave a Comment

Please login to continue.