function location_api2form in Location 5
Inverse of location_form2api()
Parameters
$location: An associative array that can be passed as the $location parameter to the location API.
Return value
An associative array with the same values modified so that the array can be passed as the $prefilled_values parameter to location_api2form()
Meant to take the standard location array format used by the public API (minus the form generating functions) and convert them into values that can be used by location_form() to fill in the prefilled values.
3 calls to location_api2form()
- location_form_alter in ./
location.module - location_user in ./
location.module - location_views_province_handler in contrib/
location_views/ location_views.module - Format a province name
File
- ./
location.inc, line 404
Code
function location_api2form($location = array()) {
$translated = array();
foreach ($location as $key => $value) {
if ($key == 'province') {
if (strlen($value) && isset($location['country']) && strlen($location['country']) && $location['province'] != 'xx' && $location['country'] != 'xx') {
$translated['province'] = $location['country'] . '-' . $value;
}
}
else {
$translated[$key] = $value;
}
}
return $translated;
}