I moved drupal_load to the top of mobile_tools_get_device from mobile_tools_is_mobile_device. When the device is set via cookie or _GET, the device detection module needs to already be loaded so that the call to mobile_tools_device_groups() returns an array -- otherwise the device selection fails. Of course, the drupal_load could be done in each of those functions, but that seems wasteful. Even this makes the assumption that mobile_tools_get_device() is going to be the first method called in this set of API functions.
There should probably be a mobile_tools_device_detection_invoke() method that loads the module if necessary and then invokes whatever it needs. That would be simple change that would definitely close the device-detection-unavailable problem, but I did not want to submit a patch that invasive.
| Comment | File | Size | Author |
|---|---|---|---|
| mt_external.patch | 888 bytes | stackpr |
Comments
Comment #1
twom commentedThx for the patch! I applied it to the dev branch, but added it to the mobile_tools_device_groups() function. This way the external module is always available if another module depends on mobile_tools and wants to call the mobile_tools_device_groups function.
Comment #2
stackpr commentedThanks!