Skip to content
Snippets Groups Projects
Commit 196f62cc authored by Brandon Bergren's avatar Brandon Bergren
Browse files

Normalize extent -- convert to the correct array format when passing in as string.

parent dd3757e8
No related branches found
No related tags found
No related merge requests found
......@@ -869,6 +869,19 @@ function gmap_map_cleanup(&$map) {
$map['latlon'] = $map['latlong'];
unset($map['latlong']);
}
// Normalize extent.
if (isset($map['extent']) && is_string($map['extent'])) {
$tmp = explode(',', $map['extent']);
if (count($tmp) == 4) {
// String form of extent has x,y, but native array form is lat,lon, so need to flip them a bit.
$map['extent'] = array(array($tmp[1], $tmp[0]), array($tmp[3], $tmp[2]));
}
else {
// Extent was unparseable, don't pass it.
unset($map['extent']);
}
}
if (isset($map['latlon']) && (!isset($map['latitude']) || !isset($map['longitude']))) {
list($map['latitude'], $map['longitude']) = explode(',', $map['latlon']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment