function location_load_location in Location 7.5
Same name and namespace in other branches
- 5.3 location.module \location_load_location()
- 6.3 location.module \location_load_location()
- 7.3 location.module \location_load_location()
- 7.4 location.module \location_load_location()
Load a single location by lid.
Parameters
$lid Location ID to load.:
Return value
A location array.
11 calls to location_load_location()
- location_cck_field in contrib/
location_cck/ location_cck.module - Implements hook_field().
- location_cck_field_load in contrib/
location_cck/ location_cck.module - Implement hook_field_load().
- location_cck_field_widget_form in contrib/
location_cck/ location_cck.module - Implement hook_field_widget_form().
- location_cck_token_values in contrib/
location_cck/ location_cck.module - Implements hook_token_values().
- location_context_create_location in plugins/
contexts/ location.inc - Create a context, either from configuration or an argument on the URL.
File
- ./
location.module, line 1001 - 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_load_location($lid) {
$location = db_query('SELECT * FROM {location} WHERE lid = :lid', array(
':lid' => $lid,
))
->fetchAssoc();
// @@@ Just thought of this, but I am not certain it is a good idea...
if (empty($location)) {
$location = array(
'lid' => $lid,
);
}
if (isset($location['source']) && $location['source'] == LOCATION_LATLON_USER_SUBMITTED) {
// Set up location chooser or lat/lon fields from the stored location.
$location['locpick'] = array(
'user_latitude' => $location['latitude'],
'user_longitude' => $location['longitude'],
);
}
// JIT Geocoding
// Geocodes during load, useful with bulk imports.
if (isset($location['source']) && $location['source'] == LOCATION_LATLON_JIT_GEOCODING) {
if (variable_get('location_jit_geocoding', FALSE)) {
_location_geo_logic($location, array(
'street' => 1,
), array());
db_update('location')
->fields(array(
'latitude' => $location['latitude'],
'longitude' => $location['longitude'],
'source' => $location['source'],
))
->condition('lid', $location['lid'])
->execute();
}
}
$location['province_name'] = '';
$location['country_name'] = '';
if (!empty($location['country'])) {
$location['country_name'] = location_country_name($location['country']);
if (!empty($location['province'])) {
$location['province_name'] = location_province_name($location['country'], $location['province']);
}
}
$location = array_merge($location, location_invoke_locationapi($location, 'load', $lid));
return $location;
}