3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00
farmOS/modules/farm/farm_map/farm_map.install
2020-02-10 14:27:49 -05:00

55 lines
1.2 KiB
Plaintext

<?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));
}
}
/**
* Delete the old farm_map_show variable.
*/
function farm_map_update_7004(&$sandbox) {
variable_del('farm_map_show');
}