You are here

function mobile_tools_switch_options in Mobile Tools 7.2

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

Generate the options required for PURL to rewrite the URL

Parameters

string $device_group: The device group you want to switch to.

Return value

string Returns options array to pass into l() or url().

2 calls to mobile_tools_switch_options()
mobile_tools_block_message in ./mobile_tools.module
Helper function returning the configurable message for the notification
mobile_tools_device_redirect in ./mobile_tools.module
Redirect the user based on the device/site type combination

File

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

Code

function mobile_tools_switch_options($device_group, $options = array()) {

  // Set the options required for each device group
  $device_groups = mobile_tools_device_groups();
  if (isset($device_groups[$device_group])) {

    // Set the options required to get the link for the mobile site
    $options['purl']['provider'] = 'spaces_mobile_tools_' . $device_group;
    $options['purl']['id'] = $device_group;
    return $options;
  }

  // Disable purl if unknown group
  $options['purl']['disabled'] = TRUE;
  return $options;
}