Add the layer group to all farm maps.

This commit is contained in:
Michael Stenta 2015-07-31 17:08:25 -04:00
parent 1c483dbc7b
commit e7deb682df
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
/**
* @file
* farm_mapknitter.default_openlayers_maps.inc
*/
/**
* Implements hook_default_openlayers_maps_alter().
*/
function farm_mapknitter_default_openlayers_maps_alter(&$maps) {
// Add the MapKnitter layer group to farm maps.
$farm_maps = array(
'farm_areas',
'farm_map_geofield',
'farm_map_geofield_formatter',
);
// Iterate over the farm maps and see if they exist.
foreach ($farm_maps as $farm_map) {
// If this map exists in the list of existing maps...
if (array_key_exists($farm_map, $maps)) {
// Add the MapKnitter layer group.
$maps[$farm_map]->options['layers'][] = 'farm_mapknitter_layer_group';
}
}
}

View File

@ -71,6 +71,9 @@ function farm_mapknitter_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "openlayers" && $api == "default_openlayers_layers") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_maps") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_sources") {
return array("version" => "1");
}