You are here

function _mobile_tools_get_active_purl_modifiers in Mobile Tools 7.2

Same name and namespace in other branches
  1. 7.3 mobile_tools.module \_mobile_tools_get_active_purl_modifiers()

Scan the active modifiers for any active mobile tools ones.

Parameters

array $modifiers: List of active PURL modifiers

Return value

array Returns an array of active mobile tools modifiers, FALSE otherwise.

1 call to _mobile_tools_get_active_purl_modifiers()
mobile_tools_get_active_device_group in ./mobile_tools.module
Get the active device group

File

./mobile_tools.module, line 812
Functionality to ease the creation of mixed device environments.

Code

function _mobile_tools_get_active_purl_modifiers($modifiers) {

  // Get a list all the mobile tools purl modifiers
  $device_groups = mobile_tools_device_groups();

  // Store only active modifiers
  $active_modifiers = FALSE;

  // Store all defined modifiers
  $defined_modifiers = array();

  // @todo store this list in a static cache for faster access
  foreach ($device_groups as $group => $name) {
    $defined_modifiers[] = 'spaces_mobile_tools_' . $group;
  }

  // Scan the list of modifiers for matches
  foreach ($modifiers as $type => $list) {

    // Mark each active modifier
    foreach ($list as $key => $modifier) {
      if (in_array($modifier->provider, $defined_modifiers)) {
        $active_modifiers[] = $modifier;
      }
    }
  }

  // Return the list of active modifiers
  return $active_modifiers;
}