Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.