Refactor the mappers to use the filters.

This commit is contained in:
David Molineus
2015-01-24 21:37:25 +01:00
parent 05d3acf21d
commit 37b10c14fe
26 changed files with 121 additions and 133 deletions

View File

@@ -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);
}
}