mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Remove default base layer setting (defer to farmOS-map layer memory).
This commit is contained in:
parent
8b8ada2a35
commit
942993d0d5
3 changed files with 7 additions and 37 deletions
|
@ -164,15 +164,4 @@ function farm_map_default_openlayers_layers_alter(&$layers) {
|
|||
if (!empty($layers['openlayers_geofield_layer_formatter'])) {
|
||||
$layers['openlayers_geofield_layer_formatter']->options['style'] = 'farm_map_style_geofield';
|
||||
}
|
||||
|
||||
// Move the default map base layer to the top.
|
||||
$base_layer = variable_get('farm_map_default_base_layer', NULL);
|
||||
if (!empty($base_layer) && !empty($layers['farm_map_layer_group'])) {
|
||||
$grouplayers = &$layers['farm_map_layer_group']->options['grouplayers'];
|
||||
$key = array_search($base_layer, $grouplayers);
|
||||
if ($key !== FALSE) {
|
||||
unset($grouplayers[$key]);
|
||||
array_unshift($grouplayers, $base_layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ function farm_map_uninstall() {
|
|||
|
||||
// Delete variables.
|
||||
variable_del('farm_map_show');
|
||||
variable_del('farm_map_default_base_layer');
|
||||
variable_del('farm_map_google_api_key');
|
||||
}
|
||||
|
||||
|
@ -29,3 +28,10 @@ function farm_map_update_7000(&$sandbox) {
|
|||
variable_set('farm_map_google_api_key', $key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the old farm_map_default_base_layer variable.
|
||||
*/
|
||||
function farm_map_update_7001(&$sandbox) {
|
||||
variable_del('farm_map_default_base_layer');
|
||||
}
|
||||
|
|
|
@ -289,18 +289,6 @@ function farm_map_settings_form($form, &$form_state) {
|
|||
'#default_value' => variable_get('farm_map_show', TRUE),
|
||||
);
|
||||
|
||||
// Specify the default base layer.
|
||||
$form['farm_map_default_base_layer'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Default base layer'),
|
||||
'#description' => t('Select the default base layer for maps.'),
|
||||
'#options' => array(
|
||||
'farm_map_layer_google_hybrid' => t('Google Hybrid'),
|
||||
'farm_map_layer_openstreetmap' => t('OpenStreetMap'),
|
||||
),
|
||||
'#default_value' => variable_get('farm_map_default_base_layer', 'farm_map_layer_google_hybrid'),
|
||||
);
|
||||
|
||||
// Google Maps API key.
|
||||
$form['farm_map_google_api_key'] = array(
|
||||
'#type' => 'textfield',
|
||||
|
@ -309,23 +297,10 @@ function farm_map_settings_form($form, &$form_state) {
|
|||
'#default_value' => variable_get('farm_map_google_api_key', ''),
|
||||
);
|
||||
|
||||
// Add a custom submit function to clear the Drupal cache on submission.
|
||||
$form['#submit'][] = 'farm_map_settings_form_submit';
|
||||
|
||||
// Return it as a system settings form.
|
||||
return system_settings_form($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit function for the farm map settings form.
|
||||
*/
|
||||
function farm_map_settings_form_submit($form, $form_state) {
|
||||
|
||||
// Clear the Drupal cache so that changes to the default map base layer
|
||||
// are picked up by Openlayers in farm_map_default_openlayers_layers_alter().
|
||||
drupal_flush_all_caches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_info().
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue