You are here

function _location_patch_locpick in Location 7.5

Same name and namespace in other branches
  1. 5.3 location.module \_location_patch_locpick()
  2. 6.3 location.module \_location_patch_locpick()
  3. 7.3 location.module \_location_patch_locpick()
  4. 7.4 location.module \_location_patch_locpick()

Apply locpick twiddling to a location. This is needed before saving and comparison.

2 calls to _location_patch_locpick()
location_is_empty in ./location.module
Checks if a location is empty, and sets up an array of filled fields.
location_save in ./location.module
Save a location.

File

./location.module, line 1177
Location module main routines. An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an…

Code

function _location_patch_locpick(&$location) {
  $inhibit_geocode = FALSE;
  if (!empty($location['locpick'])) {
    $location['locpick']['user_latitude'] = trim($location['locpick']['user_latitude']);
    $location['locpick']['user_longitude'] = trim($location['locpick']['user_longitude']);
  }

  // If the user location was set, convert it into lat / lon.
  if (!empty($location['locpick']['user_latitude']) && !empty($location['locpick']['user_longitude'])) {
    $location['source'] = LOCATION_LATLON_USER_SUBMITTED;
    $location['latitude'] = $location['locpick']['user_latitude'];
    $location['longitude'] = $location['locpick']['user_longitude'];
    $inhibit_geocode = TRUE;
  }
  return $inhibit_geocode;
}