You are here

function mobile_tools_context_init in Mobile Tools 7.3

Same name and namespace in other branches
  1. 7.2 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()) {
    if (module_exists('context')) {
      $plugin = context_get_plugin('condition', 'device_group');
      if (!empty($plugin)) {
        $device_group = mobile_tools_get_active_device_group();
        if (FALSE !== $device_group) {

          // Init the device group
          $plugin
            ->execute($device_group);
        }
      }
    }
  }
}