mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-28 11:04:08 +01:00
Use options callback to get supported layers and providers.
This commit is contained in:
@@ -112,6 +112,26 @@ class LayerDcaListener extends AbstractListener
|
||||
$this->labelRenderer = $labelRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get layer options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLayerOptions(): array
|
||||
{
|
||||
return array_keys($this->layers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tile provider options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getProviderOptions(): array
|
||||
{
|
||||
return array_keys($this->tileProviders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get variants of the tile provider.
|
||||
*
|
||||
|
||||
@@ -286,7 +286,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'chosen' => true,
|
||||
'helpwizard' => true,
|
||||
],
|
||||
'options' => array_keys($GLOBALS['LEAFLET_LAYERS']),
|
||||
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.layer', 'getLayerOptions'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['leaflet_layer'],
|
||||
'sql' => "varchar(32) NOT NULL default ''",
|
||||
],
|
||||
@@ -312,7 +312,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'submitOnChange' => true,
|
||||
'chosen' => true,
|
||||
],
|
||||
'options' => array_keys($GLOBALS['LEAFLET_TILE_PROVIDERS']),
|
||||
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.layer', 'getProviderOptions'],
|
||||
'sql' => "varchar(32) NOT NULL default ''",
|
||||
],
|
||||
'tile_provider_variant' => [
|
||||
|
||||
Reference in New Issue
Block a user