You are here

function automatic_updates_admin_form_submit in Automatic Updates 7

Submit handler for automatic_updates_admin_form.

File

./automatic_updates.admin.inc, line 140
Administration functions for Automatic Updates module.

Code

function automatic_updates_admin_form_submit($form, &$form_state) {

  // Exclude unnecessary elements.
  form_state_values_clean($form_state);
  foreach ($form_state['values'] as $key => $value) {
    if (is_array($value) && isset($form_state['values']['array_filter'])) {
      $value = array_keys(array_filter($value));
    }
    variable_set($key, $value);

    // Disable cron automatic updates if readiness checks are disabled.
    if (in_array($key, [
      'automatic_updates_enable_cron_updates',
      'automatic_updates_enable_cron_security_updates',
    ], TRUE) && !$form_state['values']['automatic_updates_enable_readiness_checks']) {
      variable_set($key, FALSE);
    }
  }
  drupal_set_message(t('The configuration options have been saved.'));
}