You are here

function getlocations_cloudmade_get_map_layers in Get Locations 7

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

@file getlocations_cloudmade.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Provides cloudmade maps integration for Leaflet.

1 call to getlocations_cloudmade_get_map_layers()
getlocations_leaflet_get_map_layers in modules/getlocations_leaflet/getlocations_leaflet.module
Function

File

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

Code

function getlocations_cloudmade_get_map_layers() {
  $cloudmade_info = variable_get('getlocations_leaflet_cloudmade', '');
  $add = array();
  if (!empty($cloudmade_info)) {
    if (isset($cloudmade_info['cloudmade_key']) && !empty($cloudmade_info['cloudmade_key'])) {
      $cloudmade_key = $cloudmade_info['cloudmade_key'];
      if (isset($cloudmade_info['cloudmade_maps']) && is_array($cloudmade_info['cloudmade_maps'])) {
        $res = getlocations_cloudmade_get_resolutions();
        $add = array();
        foreach ($cloudmade_info['cloudmade_maps'] as $k => $map) {
          $style_id = $map['style_id'];
          $style_name = $map['style_name'];
          $style_token = $map['style_token'];
          $query = '';
          if (!empty($style_token)) {
            $query = '?token=' . $style_token;
          }
          $add[$style_name] = array(
            'label' => $res[$style_name],
            'type' => 'base',
            'options' => array(
              'apiKey' => $cloudmade_key,
              'styleID' => $style_id,
              'styleToken' => $query,
            ),
          );
        }
      }
    }
  }
  return $add;
}