farmOS/modules/farm/farm_map/farm_map.install

55 lines
1.2 KiB
Plaintext
Raw Normal View History

<?php
/**
* @file
* Farm map install.
*/
/**
* Copy the Google Maps API key into the new configuration variable.
*/
function farm_map_update_7000(&$sandbox) {
// Load the Google Hybrid source.
$source = \Drupal\openlayers\Openlayers::load('Source', 'farm_map_source_google_hybrid');
// If an API key is set, copy it to the variable.
$key = $source->getOption('key');
if (!empty($key)) {
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');
}
/**
* Install new Google Maps module if an API key is saved.
*/
function farm_map_update_7002(&$sandbox) {
$module = 'farm_map_google';
if (variable_get('farm_map_google_api_key', FALSE) && !module_exists($module)) {
module_enable(array($module));
}
}
/**
* Install new Mapbox module if an API key is saved.
*/
function farm_map_update_7003(&$sandbox) {
$module = 'farm_map_mapbox';
if (variable_get('farm_map_mapbox_api_key', FALSE) && !module_exists($module)) {
module_enable(array($module));
}
}
2019-12-12 20:45:08 +01:00
/**
* Delete the old farm_map_show variable.
*/
function farm_map_update_7004(&$sandbox) {
variable_del('farm_map_show');
}