mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-28 19:13:55 +01:00
Dependency injection for the map provider.
This commit is contained in:
@@ -53,7 +53,9 @@ $container[LeafletServices::MAP_PROVIDER] = $container->share(function ($contain
|
||||
$container[LeafletServices::DEFINITION_BUILDER],
|
||||
$container[Services::EVENT_DISPATCHER],
|
||||
$container[Services::INPUT],
|
||||
$container[LeafletServices::MAP_ASSETS]
|
||||
$container[LeafletServices::MAP_ASSETS],
|
||||
$GLOBALS['LEAFLET_FILTERS'],
|
||||
\Config::get('debugMode') || \Config::get('displayErrors')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -66,6 +66,20 @@ class MapProvider
|
||||
*/
|
||||
private $assets;
|
||||
|
||||
/**
|
||||
* Request filters configuration.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $filters;
|
||||
|
||||
/**
|
||||
* Display errors setting.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $displayErrors;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
@@ -74,19 +88,25 @@ class MapProvider
|
||||
* @param EventDispatcher $eventDispatcher The Contao event dispatcher.
|
||||
* @param \Input $input Thw request input.
|
||||
* @param Assets $assets Assets handler.
|
||||
* @param array $filters Request filters configuration.
|
||||
* @param bool $displayErrors Display errors setting.
|
||||
*/
|
||||
public function __construct(
|
||||
DefinitionMapper $mapper,
|
||||
Leaflet $leaflet,
|
||||
EventDispatcher $eventDispatcher,
|
||||
\Input $input,
|
||||
Assets $assets
|
||||
Assets $assets,
|
||||
array $filters,
|
||||
$displayErrors
|
||||
) {
|
||||
$this->mapper = $mapper;
|
||||
$this->leaflet = $leaflet;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->input = $input;
|
||||
$this->assets = $assets;
|
||||
$this->filters = $filters;
|
||||
$this->displayErrors = $displayErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,12 +253,7 @@ class MapProvider
|
||||
return;
|
||||
}
|
||||
|
||||
$controller = new DataController(
|
||||
$this,
|
||||
$GLOBALS['LEAFLET_FILTERS'],
|
||||
\Config::get('debugMode') || \Config::get('displayErrors')
|
||||
);
|
||||
|
||||
$controller = new DataController($this, $this->filters, $this->displayErrors);
|
||||
$controller->execute($data);
|
||||
|
||||
if ($exit) {
|
||||
|
||||
Reference in New Issue
Block a user