forked from Snck3rs/contao-leaflet-maps
Refactor the mappers to use the filters.
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Control\Attribution;
|
||||
use Netzmacht\LeafletPHP\Definition\Map;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
|
||||
/**
|
||||
* AttributionControlMapper maps the the attribution database definition to the definition class.
|
||||
@@ -55,7 +55,7 @@ class AttributionControlMapper extends AbstractControlMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
if (!$definition instanceof Attribution) {
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
|
||||
/**
|
||||
* Class LayersControlMapper maps the control model to the layers control definition.
|
||||
@@ -43,10 +42,10 @@ class LayersControlMapper extends AbstractControlMapper
|
||||
protected function buildConstructArguments(
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
$elementId = null
|
||||
) {
|
||||
$arguments = parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
||||
$arguments = parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||
$arguments[1] = array();
|
||||
$arguments[2] = array();
|
||||
|
||||
@@ -57,7 +56,7 @@ class LayersControlMapper extends AbstractControlMapper
|
||||
foreach ($collection as $layer) {
|
||||
$argument = ($layer->controlMode === 'overlay') ? 2 : 1;
|
||||
|
||||
$arguments[$argument][] = $mapper->handle($layer, $bounds);
|
||||
$arguments[$argument][] = $mapper->handle($layer, $filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Control\Zoom;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Plugins\Loading\LoadingControl;
|
||||
use Netzmacht\LeafletPHP\Plugins\Loading\SpinJsLoadingControl;
|
||||
|
||||
@@ -36,7 +36,7 @@ class LoadingControlMapper extends AbstractControlMapper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||
{
|
||||
if ($model->spinjs) {
|
||||
return 'Netzmacht\LeafletPHP\Plugins\Loading\SpinJsLoadingControl';
|
||||
@@ -62,10 +62,10 @@ class LoadingControlMapper extends AbstractControlMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $bounds);
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof SpinJsLoadingControl && $model->spin) {
|
||||
$config = json_decode($model->spin, true);
|
||||
|
||||
Reference in New Issue
Block a user