function _gm3_field_get_array_from_points_string in Google Maps API V3 7
Helper function to get values from a points string
1 call to _gm3_field_get_array_from_points_string()
- gm3_field_field_insert in gm3_field/
gm3_field.module - Implementation of hook_field_insert().
File
- gm3_field/
gm3_field.module, line 294
Code
function _gm3_field_get_array_from_points_string($value, &$items, $type = FALSE) {
if (is_array($value) || strlen(trim($value))) {
if (is_string($value)) {
$value = explode("|", $value);
}
foreach ($value as $lat_lng) {
$lat_lng = preg_replace('/[)(]/', '', $lat_lng);
$lat_lng = explode(", ", $lat_lng);
if (count($lat_lng) == 1) {
$lat_lng = explode(",", $lat_lng[0]);
}
$lat_lng = array(
'latitude' => $lat_lng[0],
'longitude' => $lat_lng[1],
);
if ($type) {
$lat_lng['gm3_type'] = $type;
}
$items[] = $lat_lng;
}
}
}