Created
October 9, 2009 13:59
-
-
Save hugowetterberg/206045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Returns all the layers in the tile service. | |
* | |
* @return array | |
*/ | |
function simplegeo_tileservice_get_layers() { | |
static $layers; | |
$cache_key = 'simplegeo_tileservice:layers'; | |
if (!$layers && ($cache = cache_get($cache_key)) && isset($cache->data)) { | |
$layers = $cache->data; | |
} | |
if (!$layers) { | |
$layers = module_invoke_all('simplegeo_tileservice_layers'); | |
drupal_alter('simplegeo_tileservice_layers', $layers); | |
// Get rid of layers with invalid types | |
$types = simplegeo_tileservice_get_layer_types(); | |
foreach ($layers as $name => $def) { | |
if (!isset($def['type']) || !isset($types[$def['type']])) { | |
unset($types[$name]); | |
} | |
} | |
cache_set($cache_key, $layers); | |
} | |
return $layers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment