remove('HTML'); $tab = $fields->findOrMakeTab('Root.MapPins'); $tab->setTitle('Description'); $tab->push(HTMLEditorField::create('HTML', 'Content')); $fields->addFieldsToTab('Root.Main', [ NumericField::create('MapZoom', 'Initial Map Zoom (enter a number from 0 to 24)'), GridField::create( 'Locations', 'Locations', $this->owner->Locations(), $cfg = GridFieldConfig_RelationEditor::create(100) ) ]); $cfg->getComponentByType(GridFieldDataColumns::class)->setFieldFormatting([ 'ShowAtMap' => static function ($v, $obj) { return $v ? 'YES' : 'NO'; } ]); $cfg->addComponent(new BulkManager()); return $fields; } public static function MapAPIKey(): string { $type = self::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; } }