Thanks for the great module!

If another module provides a detection method via hook_mobile_theme_detection and that method is selected by the admin, the site completely blows up if that module is later uninstalled.

The error looks like:
Fatal error: Call to undefined function ____ in ____/sites/all/modules/mobile_theme/mobile_theme.module on line 61

The mobile_theme_custom_theme function can be changed as follows to fix the issue (note use of function_exists()).

/**
 * Implements hook_custom_theme().
 */
function mobile_theme_custom_theme() {
  // Retrieve the detection method.
  $method = variable_get('mobile_theme_detection', 'mobile_theme_detect_getbrowser');
  
  // If the detection method cannot be found, revert to default
  if(!function_exists($method)){
    $method = "mobile_theme_detect_getbrowser";
  }

  // Check if this is a mobile 
  $mobile_device = $method();
  if ($mobile_device) {
    $theme = variable_get('mobile_theme_selection', 'default');
    if ($theme != 'default') {
      return $theme;
    }
  }
}

Comments

RobLoach’s picture

Status: Active » Fixed

Good call! http://drupalcode.org/project/mobile_theme.git/commit/aeb6596

Whoops, left the commit documentation in there hahaha.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.