You are here

function mobile_switch_settings_form_submit in Mobile Switch 7.2

Same name and namespace in other branches
  1. 6 includes/mobile_switch.admin.inc \mobile_switch_settings_form_submit()
  2. 7 includes/mobile_switch.admin.inc \mobile_switch_settings_form_submit()

Form submission handler for multiple mobile switch setting forms.

See also

mobile_switch_settings_form()

mobile_switch_advanced_settings_form()

mobile_switch_development_settings_form()

3 string references to 'mobile_switch_settings_form_submit'
mobile_switch_advanced_settings_form in includes/mobile_switch.admin.inc
Form constructor for the Advanced settings form.
mobile_switch_development_settings_form in includes/mobile_switch.admin.inc
Form constructor for the Development settings form.
mobile_switch_settings_form in includes/mobile_switch.admin.inc
Form constructor for the Basic settings form.

File

includes/mobile_switch.admin.inc, line 292
Administrative page callbacks for the Mobile Switch module.

Code

function mobile_switch_settings_form_submit($form, &$form_state) {
  $mode = FALSE;
  if (isset($form_state['values']['mobile_switch_mobile_theme'])) {
    $mode = $form_state['values']['mobile_switch_mobile_theme'];
  }
  if (isset($mode)) {
    if ($mode === 'none') {
      variable_set('mobile_switch_developer', 0);
      variable_set('mobile_switch_deskbrowser', 0);
      variable_set('mobile_switch_display_mobiledetectinfo', 0);
    }

    // Check if enabled 'Cache pages for anonymous users'.
    if ($mode != 'none' && $mode != 'detectonly' && $mode != 'redirect' && variable_get('cache', 0) == TRUE) {
      drupal_set_message(t('Note: Cache pages for anonymous users produces problems with the current operating mode.'), 'warning');
    }
  }

  // It exist problems if used a "mobile jQuery" based theme as mobile theme.
  // This problems cannot be solved here.
  drupal_flush_all_caches();
  drupal_set_message(t('Caches cleared.'), 'status');
}