You are here

function mobile_tools_switch_theme in Mobile Tools 6

Same name and namespace in other branches
  1. 6.3 mobile_tools.module \mobile_tools_switch_theme()
  2. 6.2 mobile_tools.module \mobile_tools_switch_theme()

Being called in the hook_boot() implementation This function is in charge of changing to the mobile theme

1 call to mobile_tools_switch_theme()
mobile_tools_boot in ./mobile_tools.module
Implementation of hook_boot(). Hook boot is called for both anonymous users and logged in users

File

./mobile_tools.module, line 212
Mobile Tools provides a range of functionality assisting in creating a mobile Drupal site . this functionality contains:

Code

function mobile_tools_switch_theme($device) {
  global $custom_theme, $conf;

  // check if theme switching is forced
  $current_url_type = mobile_tools_is_mobile_site();
  if ($current_url_type == 'mobile' && variable_get('mobile-tools-theme-switch', '') == 'mobile-tools-mobile-url' || variable_get('mobile-tools-theme-switch', '') == 'mobile-tools-mobile-device' && $device['type'] == 'mobile') {
    $group = $device['group'];
    $mobile_detection_module = variable_get('mobile-tools-device-detection', 'mobile_tools');
    if (variable_get($mobile_detection_module . '_' . $group . '_enable', '') == 1) {
      $custom_theme = variable_get($mobile_detection_module . '_' . $group . '_theme', $conf['theme_default']);
      return TRUE;
    }
    else {
      $custom_theme = variable_get('mobile_tools_theme_name', $conf['theme_default']);
      return TRUE;
    }
  }
  return FALSE;
}