mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
FIX: MapAPI key
This commit is contained in:
parent
8f8306cc9e
commit
6d82e2826f
@ -44,8 +44,8 @@ class SiteConfigExtension extends DataExtension
|
||||
{
|
||||
private static $db = [
|
||||
'ExtraCode' => 'Text',
|
||||
'Longitude' => 'Decimal(10, 8)',
|
||||
'Latitude' => 'Decimal(11, 8)',
|
||||
'Lng' => 'Decimal(10, 8)',
|
||||
'Lat' => 'Decimal(11, 8)',
|
||||
'MapZoom' => 'Int',
|
||||
'Description' => 'Varchar(255)',
|
||||
'Address' => 'Varchar(255)',
|
||||
@ -122,7 +122,7 @@ class SiteConfigExtension extends DataExtension
|
||||
// Get country field
|
||||
$countryLabel = _t('Addressable.COUNTRY', 'Country');
|
||||
$allowedCountries = Config::inst()->get(SiteConfig::class, 'allowed_countries');
|
||||
if($allowedCountries && count($allowedCountries) >= 1) {
|
||||
if ($allowedCountries && count($allowedCountries) >= 1) {
|
||||
$addrFields[] = DropdownField::create(
|
||||
'Country',
|
||||
$countryLabel,
|
||||
@ -167,16 +167,38 @@ class SiteConfigExtension extends DataExtension
|
||||
|
||||
public function getGeoJSON()
|
||||
{
|
||||
return '{"type": "MarkerCollection","features": [{"type": "Feature","icon": "<i class=\'fas fa-map-marker-alt\'></i>",'
|
||||
.'"properties": {"content": "'.$this->owner->getTitle().'"},"geometry": {"type": "Point",'
|
||||
.'"coordinates": ['.$this->owner->getField('Lng').','.$this->owner->getField('Lat').']}}]}';
|
||||
return \json_encode([
|
||||
'type' => 'MarkerCollection',
|
||||
'features' => [
|
||||
[
|
||||
'id' => 'SiteConfig' . $this->owner->ID,
|
||||
'type' => 'Feature',
|
||||
'icon' => '<i class="fa-icon fas fa-map-marker-alt"></i>',
|
||||
'properties' => [
|
||||
'content' => $this->owner->renderWith('A2nt/ElementalBasics/Models/MapPin'),
|
||||
],
|
||||
'geometry' => [
|
||||
'type' => 'Point',
|
||||
'coordinates' => [
|
||||
$this->owner->Lng,
|
||||
$this->owner->Lat,
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function DirectionsLinkURL()
|
||||
{
|
||||
return 'https://www.google.com/maps/dir/Current+Location/'
|
||||
.$this->owner->Lat.','
|
||||
.$this->owner->Lng;
|
||||
}
|
||||
|
||||
public function DirectionsLink()
|
||||
{
|
||||
return '<a href="https://www.google.com/maps/dir/Current+Location/'
|
||||
.$this->owner->getField('Lat').','
|
||||
.$this->owner->getField('Lng').'" class="btn btn-primary btn-directions" target="_blank">'
|
||||
return '<a href="'.$this->DirectionsLinkURL().'" class="btn btn-primary btn-directions" target="_blank">'
|
||||
.'<i class="fas fa-road"></i> Get Directions</a>';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user