You are here

function getlocations_mapquest_library in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_mapquest/getlocations_mapquest.module \getlocations_mapquest_library()

Implements hook_library().

File

modules/getlocations_mapquest/getlocations_mapquest.module, line 67
getlocations_mapquest.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_mapquest_library() {

  #$aggr = (getlocations_aggr_get() ? TRUE : FALSE);
  $mapquest_lic = variable_get('getlocations_mapquest_lic', array(
    'key' => '',
    'type' => 'l',
  ));
  $defaults = getlocations_defaults();
  $version = '7.2.s';
  $libraries = array();
  $libraries['mapquest'] = array(
    'title' => 'Mapquest',
    'website' => 'http://www.mapquest.com',
    'version' => $version,
  );
  if ($mapquest_lic['key']) {
    if (!isset($defaults['is_https']) || !$defaults['is_https']) {
      global $is_https;
    }
    else {
      $is_https = $defaults['is_https'];
    }
    $scheme = $is_https ? 'https' : 'http';
    if ($mapquest_lic['type'] == 'o') {
      $dom = 'open.mapquestapi.com/sdk/js/v' . $version;
    }
    else {
      $dom = 'www.mapquestapi.com/sdk/js/v' . $version;
    }
    $url = $scheme . '://' . $dom . '/' . 'mqa.toolkit.js' . '?key=' . $mapquest_lic['key'];
    $libraries['mapquest']['js'] = array(
      $url => array(
        'type' => 'external',
      ),
    );
  }
  return $libraries;
}