Closed (fixed)
Project:
Mobile Theme
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Mar 2011 at 05:01 UTC
Updated:
7 Apr 2011 at 15:21 UTC
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
Comment #1
robloachGood call! http://drupalcode.org/project/mobile_theme.git/commit/aeb6596
Whoops, left the commit documentation in there hahaha.