forked from Snck3rs/contao-leaflet-maps
Use dependency injection for the provider layer mapper.
This commit is contained in:
@@ -88,7 +88,12 @@ $GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\MapMapper';
|
|||||||
|
|
||||||
// Layer mappers.
|
// Layer mappers.
|
||||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\TileLayerMapper';
|
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\TileLayerMapper';
|
||||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderLayerMapper';
|
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
|
||||||
|
return new \Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderLayerMapper(
|
||||||
|
$GLOBALS['LEAFLET_TILE_PROVIDERS']
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper';
|
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper';
|
||||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\GroupLayerMapper';
|
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\GroupLayerMapper';
|
||||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper';
|
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper';
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
|||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.Superglobals)
|
* @param array $providers Registered providers.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(array $providers)
|
||||||
{
|
{
|
||||||
$this->providers = &$GLOBALS['LEAFLET_TILE_PROVIDERS'];
|
$this->providers = $providers;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user