Add a general-purpose layer switcher.

This commit is contained in:
Michael Stenta 2015-07-28 11:48:35 -04:00
parent d41fab6da1
commit 427cf490dc
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,26 @@
<?php
/**
* @file
* farm_map.default_openlayers_controls.inc
*/
/**
* Implements hook_default_openlayers_controls().
*/
function farm_map_default_openlayers_controls() {
$export = array();
$ol_control = new stdClass();
$ol_control->disabled = FALSE; /* Edit this to true to make a default ol_control disabled initially */
$ol_control->api_version = 1;
$ol_control->machine_name = 'farm_map_control_layer_switcher';
$ol_control->name = 'Farm Map Control: Layer Switcher';
$ol_control->description = '';
$ol_control->factory_service = 'openlayers.Control:OL3LayerSwitcher';
$ol_control->options = array(
'collapsible' => 0,
);
$export['farm_map_control_layer_switcher'] = $ol_control;
return $export;
}

View File

@ -11,6 +11,9 @@ function farm_map_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "openlayers" && $api == "default_openlayers_components") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_controls") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_layers") {
return array("version" => "1");
}

View File

@ -7,7 +7,9 @@ dependencies[] = features
dependencies[] = geofield
dependencies[] = openlayers
dependencies[] = openlayers_geofield
dependencies[] = openlayers_library
features[ctools][] = openlayers:default_openlayers_components:1
features[ctools][] = openlayers:default_openlayers_controls:1
features[ctools][] = openlayers:default_openlayers_layers:1
features[ctools][] = openlayers:default_openlayers_maps:1
features[ctools][] = openlayers:default_openlayers_sources:1
@ -15,6 +17,7 @@ features[ctools][] = openlayers:default_openlayers_styles:1
features[features_api][] = api:2
features[field_base][] = field_farm_geofield
features[openlayers_components][] = farm_map_component_geofield_zoom_to_source
features[openlayers_controls][] = farm_map_control_layer_switcher
features[openlayers_layers][] = farm_map_google_hybrid
features[openlayers_maps][] = farm_map_geofield
features[openlayers_maps][] = farm_map_geofield_formatter