function mobile_tools_context_init in Mobile Tools 7.2
Same name and namespace in other branches
- 7.3 mobile_tools_context/mobile_tools_context.module \mobile_tools_context_init()
Implements hook_init().
File
- mobile_tools_context/
mobile_tools_context.module, line 13 - Define mobile contexts. Works with the Context module as well as contexts with CTools
Code
function mobile_tools_context_init() {
if (!drupal_is_cli()) {
/**
* We set the context
*/
if (module_exists('context')) {
$plugin = context_get_plugin('condition', 'mobile');
if (!empty($plugin)) {
$device = mobile_tools_get_active_device_group();
// Init all active device groups
foreach ($device as $key => $group) {
$plugin
->execute($group['type']);
}
}
}
}
}