Update SiteConfigExtension.php
This commit is contained in:
parent
4f3d39f7ad
commit
3442745c4e
|
@ -11,6 +11,26 @@ class SiteConfigExtension extends Extension
|
|||
{
|
||||
return MapboxField::getAccessToken();
|
||||
}
|
||||
|
||||
public static function MapAPIKeyFrontend(): 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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue