Skip to content

Commit

Permalink
dont add marker if coords are invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin10 committed Oct 2, 2011
1 parent b5421a7 commit 9353d6d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Templating/Helper/MapHelper.php
Expand Up @@ -109,6 +109,10 @@ public function prepareAndRender($alias, $obj)
foreach ($obj as $entity) {
list($lat, $lng) = $this->getLatLng($entity);

if (($lat == 0 && $lng == 0) || is_null($lat) || is_null($lng)) {
continue;
}

$marker = new MapMarker($lat, $lng);

if ($map->getShowInfoWindowsForMarkers()) {
Expand All @@ -125,9 +129,7 @@ public function prepareAndRender($alias, $obj)
}

if (!$map->getAutoZoom() && count($obj) == 1) {
if (!is_null($lat) && !is_null($lng)) {
$map->setCenter($lat, $lng);
}
$map->setCenter($lat, $lng);
} else {
$map->setAutoZoom(true);
}
Expand Down

0 comments on commit 9353d6d

Please sign in to comment.