Skip to content

Commit

Permalink
FIX: Error in hasGeo logic and PSR2
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonbanderson committed Jan 5, 2016
1 parent fde6df4 commit 37f3ef3
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions code/PointsOfInterestLayerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ class PointsOfInterestLayerExtension extends DataExtension
),
);

/**
* Only set has geo to true if layers exist
* @param boolean &$hasGeo will be set to true if any layers
*/
public function updateHasGeo(&$hasGeo) {
if ($this->owner->PointsOfInterestLayers()->count() > 0) {
$result = true;
}
}

/**
* Update cms fields - add list of POIs.
*
Expand All @@ -47,26 +37,36 @@ public function updateCMSFields(FieldList $fields)
* @param MapAPI &$map reference to object representing the map
* @param $autozoom will be altered to true for autozoom, false not to
*/
public function updateBasicMap(&$map, &$autozoom) {
if (Object::has_extension($this->owner->ClassName, 'PointsOfInterestLayerExtension')) {
foreach($this->owner->PointsOfInterestLayers() as $layer) {
$layericon = $layer->DefaultIcon();
if ($layericon->ID === 0) {
$layericon = null;
}
foreach ($layer->PointsOfInterest() as $poi) {
if ($poi->MapPinEdited) {
if ($poi->MapPinIconID == 0 && $layericon) {
$poi->CachedMapPinURL = $layericon->getAbsoluteURL();
}
$map->addMarkerAsObject($poi);

// we have a point of interest, so turn on auto zoom
$autozoom = true;
public function updateBasicMap(&$map, &$autozoom)
{
foreach($this->owner->PointsOfInterestLayers() as $layer) {
$layericon = $layer->DefaultIcon();
if ($layericon->ID === 0) {
$layericon = null;
}
foreach ($layer->PointsOfInterest() as $poi) {
if ($poi->MapPinEdited) {
if ($poi->MapPinIconID == 0 && $layericon) {
$poi->CachedMapPinURL = $layericon->getAbsoluteURL();
}
$map->addMarkerAsObject($poi);

// we have a point of interest, so turn on auto zoom
$autozoom = true;
}
}
$map->setClusterer(true);
}
$map->setClusterer(true);
}

/**
* Only set has geo to true if layers exist
* @param boolean &$hasGeo will be set to true if any layers
*/
public function updateHasGeo(&$hasGeo)
{
if ($this->owner->PointsOfInterestLayers()->count() > 0) {
$hasGeo = true;
}
}
}

0 comments on commit 37f3ef3

Please sign in to comment.