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

31 lines
684 B
Text

<?php
/**
* @file
* Farm map install.
*/
/**
* Implements hook_uninstall().
*/
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');
}
/**
* 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);
}
}