From 24f48211785b384b8fc39fa3a65492792f977202 Mon Sep 17 00:00:00 2001
From: Brandon Bergren <bdragon@rtk0.net>
Date: Thu, 27 Jan 2011 22:39:19 +0000
Subject: [PATCH] Normalize extent -- convert to the correct array format when
 passing in as string.

---
 gmap.module | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gmap.module b/gmap.module
index 556ca6f..51c328f 100644
--- a/gmap.module
+++ b/gmap.module
@@ -828,6 +828,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']);
   }
-- 
GitLab