1 system.admin.inc system_site_maintenance_mode_submit($form, &$form_state)

Submit handler for the system_site_maintenance_mode() form.

File

core/modules/system/system.admin.inc, line 2190
Admin page callbacks for the System module.

Code

function system_site_maintenance_mode_submit($form, &$form_state) {
  state_set('maintenance_mode', (bool) $form_state['values']['maintenance_mode']);
  config_set('system.core', 'maintenance_mode_message', $form_state['values']['maintenance_mode_message']);

  // Give specific messages on the primary action for this form.
  if ($form_state['values']['maintenance_mode'] && current_path() == 'admin/config/development/maintenance') {
    backdrop_set_message(t('The site is now in maintenance mode. Only users with the "Access site in maintenance mode" permission will be able to access the site.'), 'warning');
  }
  elseif ($form['maintenance_mode']['#default_value'] != $form_state['values']['maintenance_mode']) {
    backdrop_get_messages();
    backdrop_set_message(t('The site is no longer in maintenance mode.'));
  }
  else {
    backdrop_set_message(t('The configuration options have been saved.'));
  }
}