forked from Snck3rs/contao-leaflet-maps
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[LeafletServices::DEFINITION_BUILDER],
|
||||||
$container[Services::EVENT_DISPATCHER],
|
$container[Services::EVENT_DISPATCHER],
|
||||||
$container[Services::INPUT],
|
$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;
|
private $assets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request filters configuration.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $filters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display errors setting.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $displayErrors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
*
|
*
|
||||||
@@ -74,19 +88,25 @@ class MapProvider
|
|||||||
* @param EventDispatcher $eventDispatcher The Contao event dispatcher.
|
* @param EventDispatcher $eventDispatcher The Contao event dispatcher.
|
||||||
* @param \Input $input Thw request input.
|
* @param \Input $input Thw request input.
|
||||||
* @param Assets $assets Assets handler.
|
* @param Assets $assets Assets handler.
|
||||||
|
* @param array $filters Request filters configuration.
|
||||||
|
* @param bool $displayErrors Display errors setting.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
Leaflet $leaflet,
|
Leaflet $leaflet,
|
||||||
EventDispatcher $eventDispatcher,
|
EventDispatcher $eventDispatcher,
|
||||||
\Input $input,
|
\Input $input,
|
||||||
Assets $assets
|
Assets $assets,
|
||||||
|
array $filters,
|
||||||
|
$displayErrors
|
||||||
) {
|
) {
|
||||||
$this->mapper = $mapper;
|
$this->mapper = $mapper;
|
||||||
$this->leaflet = $leaflet;
|
$this->leaflet = $leaflet;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->input = $input;
|
$this->input = $input;
|
||||||
$this->assets = $assets;
|
$this->assets = $assets;
|
||||||
|
$this->filters = $filters;
|
||||||
|
$this->displayErrors = $displayErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,12 +253,7 @@ class MapProvider
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller = new DataController(
|
$controller = new DataController($this, $this->filters, $this->displayErrors);
|
||||||
$this,
|
|
||||||
$GLOBALS['LEAFLET_FILTERS'],
|
|
||||||
\Config::get('debugMode') || \Config::get('displayErrors')
|
|
||||||
);
|
|
||||||
|
|
||||||
$controller->execute($data);
|
$controller->execute($data);
|
||||||
|
|
||||||
if ($exit) {
|
if ($exit) {
|
||||||
|
|||||||
Reference in New Issue
Block a user