Skip to content

Commit

Permalink
BUGFIX strtoupper null value deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
muskie9 committed Oct 5, 2022
1 parent 47e3832 commit 5648be7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/AddressDataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="'.$googleMapURL.'" target="_blank">'.$googleMapURL.'</a></div></div>';
$googleMapURL = 'https://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
$googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
$compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
}
if ($this->owner->LatLngOverride) {
Expand All @@ -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));
}

Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 5648be7

Please sign in to comment.