mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-03-03 10:38:14 +01:00
Refactor the mappers to use the filters.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
||||
@@ -19,8 +20,6 @@ use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection;
|
||||
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
||||
|
||||
/**
|
||||
* Class MarkersLayerMapper maps the layer model to the markers definition.
|
||||
@@ -39,7 +38,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||
{
|
||||
if ($model->deferred) {
|
||||
return 'Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson';
|
||||
@@ -54,7 +53,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
protected function buildConstructArguments(
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
$elementId = null
|
||||
) {
|
||||
if ($model->deferred) {
|
||||
@@ -75,7 +74,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
return array($this->getElementId($model, $elementId), RequestUrl::create($model->id));
|
||||
}
|
||||
|
||||
return parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
||||
return parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +84,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
if ($definition instanceof GeoJson) {
|
||||
@@ -115,7 +114,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
||||
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||
{
|
||||
$feature = new FeatureCollection();
|
||||
$collection = $this->loadMarkerModels($model);
|
||||
|
||||
Reference in New Issue
Block a user