mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-06-25 21:39:18 +02:00
FIX: MapAPI key
This commit is contained in:
parent
110ec251a7
commit
8f8306cc9e
|
@ -160,26 +160,6 @@ class SiteConfigExtension extends DataExtension
|
||||||
)*/
|
)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function MapAPIKey(): string
|
|
||||||
{
|
|
||||||
$type = $this->owner->config()->get('map_type');
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case 'mapbox':
|
|
||||||
$key = MapboxField::getAccessToken();
|
|
||||||
break;
|
|
||||||
case 'google-maps':
|
|
||||||
$cfg = Config::inst()->get(GoogleMapField::class, 'default_options');
|
|
||||||
$key = $cfg['api_key'];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$key = '';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function MapStyle()
|
public function MapStyle()
|
||||||
{
|
{
|
||||||
return MapboxField::config()->get('map_style');
|
return MapboxField::config()->get('map_style');
|
||||||
|
@ -189,14 +169,14 @@ class SiteConfigExtension extends DataExtension
|
||||||
{
|
{
|
||||||
return '{"type": "MarkerCollection","features": [{"type": "Feature","icon": "<i class=\'fas fa-map-marker-alt\'></i>",'
|
return '{"type": "MarkerCollection","features": [{"type": "Feature","icon": "<i class=\'fas fa-map-marker-alt\'></i>",'
|
||||||
.'"properties": {"content": "'.$this->owner->getTitle().'"},"geometry": {"type": "Point",'
|
.'"properties": {"content": "'.$this->owner->getTitle().'"},"geometry": {"type": "Point",'
|
||||||
.'"coordinates": ['.$this->owner->getField('Longitude').','.$this->owner->getField('Latitude').']}}]}';
|
.'"coordinates": ['.$this->owner->getField('Lng').','.$this->owner->getField('Lat').']}}]}';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DirectionsLink()
|
public function DirectionsLink()
|
||||||
{
|
{
|
||||||
return '<a href="https://www.google.com/maps/dir/Current+Location/'
|
return '<a href="https://www.google.com/maps/dir/Current+Location/'
|
||||||
.$this->owner->getField('Latitude').','
|
.$this->owner->getField('Lat').','
|
||||||
.$this->owner->getField('Longitude').'" class="btn btn-primary btn-directions" target="_blank">'
|
.$this->owner->getField('Lng').'" class="btn btn-primary btn-directions" target="_blank">'
|
||||||
.'<i class="fas fa-road"></i> Get Directions</a>';
|
.'<i class="fas fa-road"></i> Get Directions</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user