You are here

function locationmap_update_105 in Location Map 7.2

Same name and namespace in other branches
  1. 8.2 locationmap.install \locationmap_update_105()

Change maps API v2 variables to v3 values. Unset the API key var, as it's not required any more.

File

./locationmap.install, line 79
Install, update and uninstall functions for the locationmap module.

Code

function locationmap_update_105() {
  $locationmap_type = variable_get('locationmap_type', '');

  // Only do anything if this is set
  if ($locationmap_type) {

    // Maps old values to new values:
    $locationmap_type_new = array(
      'G_NORMAL_MAP' => 'google.maps.MapTypeId.ROADMAP',
      'G_SATELLITE_MAP' => 'google.maps.MapTypeId.SATELLITE',
      'G_HYBRID_MAP' => 'google.maps.MapTypeId.HYBRID',
    );

    // Only reset this if it's a value we can translate:
    if (isset($locationmap_type_new[$locationmap_type])) {
      variable_set('locationmap_type', $locationmap_type_new[$locationmap_type]);
    }
  }

  // We don't need this any more
  variable_del('locationmap_key');
}