diff --git a/src/AddressDataExtension.php b/src/AddressDataExtension.php index f5f25b9..717ad48 100644 --- a/src/AddressDataExtension.php +++ b/src/AddressDataExtension.php @@ -66,8 +66,8 @@ public function updateCMSFields(FieldList $fields) $overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.'); if ($this->owner->Lng && $this->owner->Lat) { - $googleMapURL = 'https://maps.google.com/?q='.$this->owner->Lat.','.$this->owner->Lng; - $googleMapDiv = '
'; + $googleMapURL = 'https://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng; + $googleMapDiv = ''; $compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv)); } if ($this->owner->LatLngOverride) { @@ -94,9 +94,12 @@ public function getFullAddress() $this->owner->City, $this->owner->State, $this->owner->PostalCode, - strtoupper($this->owner->Country), ]; + if ($this->owner->Country !== null) { + $parts[] = strtoupper($this->owner->Country); + } + return implode(', ', array_filter($parts)); } @@ -190,8 +193,8 @@ public static function getMapStyleJSON() /** * Gets the maker icon image - * @var boolean $svg if svgs should be included * @return null|string + * @var boolean $svg if svgs should be included */ public static function getIconImage($svg = true) {