mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-30 12:03:44 +01:00
Use the repository manager.
This commit is contained in:
@@ -9,6 +9,8 @@ services:
|
|||||||
# Map mapper
|
# Map mapper
|
||||||
netzmacht.contao_leaflet.mapper.map:
|
netzmacht.contao_leaflet.mapper.map:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\MapMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\MapMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
@@ -28,26 +30,36 @@ services:
|
|||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.markers_layer:
|
netzmacht.contao_leaflet.mapper.markers_layer:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.group_layer:
|
netzmacht.contao_leaflet.mapper.group_layer:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\GroupLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\GroupLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.vectors_layer:
|
netzmacht.contao_leaflet.mapper.vectors_layer:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.reference_layer:
|
netzmacht.contao_leaflet.mapper.reference_layer:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\ReferenceLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\ReferenceLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.overpass_layer:
|
netzmacht.contao_leaflet.mapper.overpass_layer:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\OverpassLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\OverpassLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
@@ -55,11 +67,14 @@ services:
|
|||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkerClusterLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkerClusterLayerMapper
|
||||||
arguments:
|
arguments:
|
||||||
- '@netzmacht.contao_leaflet.map.assets'
|
- '@netzmacht.contao_leaflet.map.assets'
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leflet_maps.mapper }
|
- { name: netzmacht.contao_leflet_maps.mapper }
|
||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.file_layer:
|
netzmacht.contao_leaflet.mapper.file_layer:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
@@ -86,6 +101,8 @@ services:
|
|||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.loading_control:
|
netzmacht.contao_leaflet.mapper.loading_control:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Control\LoadingControlMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\LoadingControlMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
@@ -99,6 +116,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.polyline:
|
netzmacht.contao_leaflet.mapper.polyline:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\PolylineMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\PolylineMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -106,6 +124,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.multi_polyline:
|
netzmacht.contao_leaflet.mapper.multi_polyline:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolylineMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolylineMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -113,6 +132,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.polygon:
|
netzmacht.contao_leaflet.mapper.polygon:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\PolygonMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\PolygonMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -120,6 +140,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.multi_polygon:
|
netzmacht.contao_leaflet.mapper.multi_polygon:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolygonMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolygonMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -127,6 +148,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.circle:
|
netzmacht.contao_leaflet.mapper.circle:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -134,6 +156,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.circle_mapper:
|
netzmacht.contao_leaflet.mapper.circle_mapper:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMarkerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMarkerMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -141,6 +164,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.rectangle_mapper:
|
netzmacht.contao_leaflet.mapper.rectangle_mapper:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Vector\RectangleMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\RectangleMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
@@ -154,6 +178,8 @@ services:
|
|||||||
|
|
||||||
netzmacht.contao_leaflet.mapper.image_icon:
|
netzmacht.contao_leaflet.mapper.image_icon:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Type\ImageIconMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Type\ImageIconMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
@@ -175,6 +201,7 @@ services:
|
|||||||
netzmacht.contao_leaflet.mapper.marker:
|
netzmacht.contao_leaflet.mapper.marker:
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper
|
||||||
arguments:
|
arguments:
|
||||||
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
- '@netzmacht.contao_leaflet.frontend.value_filter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use Contao\Model;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Control\Zoom;
|
use Netzmacht\LeafletPHP\Definition\Control\Zoom;
|
||||||
use Netzmacht\LeafletPHP\Plugins\Loading\LoadingControl;
|
use Netzmacht\LeafletPHP\Plugins\Loading\LoadingControl;
|
||||||
@@ -35,6 +36,25 @@ class LoadingControlMapper extends AbstractControlMapper
|
|||||||
*/
|
*/
|
||||||
protected static $type = 'loading';
|
protected static $type = 'loading';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -79,7 +99,8 @@ class LoadingControlMapper extends AbstractControlMapper
|
|||||||
|
|
||||||
if ($definition instanceof LoadingControl && !$definition->isSeparate() && $model->zoomControl) {
|
if ($definition instanceof LoadingControl && !$definition->isSeparate() && $model->zoomControl) {
|
||||||
// Only assign if zoom control is activated and part of the map.
|
// Only assign if zoom control is activated and part of the map.
|
||||||
$control = ControlModel::findOneBy(
|
$repository = $this->repositoryManager->getRepository(ControlModel::class);
|
||||||
|
$control = $repository->findOneBy(
|
||||||
['active=1', 'type=?', 'pid=?', 'id=?'],
|
['active=1', 'type=?', 'pid=?', 'id=?'],
|
||||||
['zoom', $model->pid, $model->zoomControl]
|
['zoom', $model->pid, $model->zoomControl]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use Contao\FilesModel;
|
|||||||
use Contao\Model;
|
use Contao\Model;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\FeatureGroup;
|
use Netzmacht\LeafletPHP\Definition\Group\FeatureGroup;
|
||||||
@@ -50,6 +51,25 @@ class FileLayerMapper extends AbstractLayerMapper
|
|||||||
*/
|
*/
|
||||||
protected static $definitionClass = FeatureGroup::class;
|
protected static $definitionClass = FeatureGroup::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +80,8 @@ class FileLayerMapper extends AbstractLayerMapper
|
|||||||
$elementId = null,
|
$elementId = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
$fileModel = FilesModel::findByPk($model->file);
|
$repository = $this->repositoryManager->getRepository(FilesModel::class);
|
||||||
|
$fileModel = $repository->findByPk($model->file);
|
||||||
$definition = $this->createInstance($model, $mapper, $request, $elementId, $fileModel);
|
$definition = $this->createInstance($model, $mapper, $request, $elementId, $fileModel);
|
||||||
|
|
||||||
$this->optionsBuilder->build($definition, $model);
|
$this->optionsBuilder->build($definition, $model);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use Contao\Model;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\FeatureGroup;
|
use Netzmacht\LeafletPHP\Definition\Group\FeatureGroup;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\LayerGroup;
|
use Netzmacht\LeafletPHP\Definition\Group\LayerGroup;
|
||||||
@@ -35,6 +36,25 @@ class GroupLayerMapper extends AbstractLayerMapper
|
|||||||
*/
|
*/
|
||||||
protected static $type = 'group';
|
protected static $type = 'group';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +81,8 @@ class GroupLayerMapper extends AbstractLayerMapper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$collection = LayerModel::findBy(
|
$repository = $this->repositoryManager->getRepository(LayerModel::class);
|
||||||
|
$collection = $repository->findBy(
|
||||||
['pid=?', 'active=1'],
|
['pid=?', 'active=1'],
|
||||||
[$model->id],
|
[$model->id],
|
||||||
['order' => 'sorting']
|
['order' => 'sorting']
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
|
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
@@ -53,15 +54,24 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
|
|||||||
private $assets;
|
private $assets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MarkerClusterLayerMapper constructor.
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
*
|
*
|
||||||
* @param ContaoAssets $assets Assets manager.
|
* @param ContaoAssets $assets Assets manager.
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
*/
|
*/
|
||||||
public function __construct(ContaoAssets $assets)
|
public function __construct(ContaoAssets $assets, RepositoryManager $repositoryManager)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
$this->assets = $assets;
|
$this->assets = $assets;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +117,8 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
|
|||||||
$this->assets->addStylesheet('assets/leaflet/libs/leaflet-markercluster/MarkerCluster.Default.css');
|
$this->assets->addStylesheet('assets/leaflet/libs/leaflet-markercluster/MarkerCluster.Default.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
$collection = LayerModel::findBy(
|
$repository = $this->repositoryManager->getRepository(LayerModel::class);
|
||||||
|
$collection = $repository->findBy(
|
||||||
['pid=?', 'active=1'],
|
['pid=?', 'active=1'],
|
||||||
[$model->id],
|
[$model->id],
|
||||||
['order' => 'sorting']
|
['order' => 'sorting']
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
||||||
@@ -38,6 +39,25 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
*/
|
*/
|
||||||
protected static $type = 'markers';
|
protected static $type = 'markers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -154,10 +174,12 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
*/
|
*/
|
||||||
protected function loadMarkerModels(Model $model, Request $request = null)
|
protected function loadMarkerModels(Model $model, Request $request = null)
|
||||||
{
|
{
|
||||||
|
$repository = $this->repositoryManager->getRepository(MarkerModel::class);
|
||||||
|
|
||||||
if ($model->boundsMode == 'fit') {
|
if ($model->boundsMode == 'fit') {
|
||||||
return MarkerModel::findByFilter($model->id, $request->getFilter());
|
return $repository->findByFilter($model->id, $request->getFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
return MarkerModel::findByFilter($model->id);
|
return $repository->findByFilter($model->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use Netzmacht\Contao\Leaflet\Definition\Layer\OverpassLayer;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
|
|
||||||
@@ -41,6 +42,25 @@ class OverpassLayerMapper extends AbstractLayerMapper
|
|||||||
*/
|
*/
|
||||||
protected static $definitionClass = OverpassLayer::class;
|
protected static $definitionClass = OverpassLayer::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -97,7 +117,8 @@ class OverpassLayerMapper extends AbstractLayerMapper
|
|||||||
$amenityIconsMap = $this->filterAmenityIconsConfig($model->amenityIcons);
|
$amenityIconsMap = $this->filterAmenityIconsConfig($model->amenityIcons);
|
||||||
|
|
||||||
if ($amenityIconsMap) {
|
if ($amenityIconsMap) {
|
||||||
$collection = IconModel::findMultipleByIds(array_unique($amenityIconsMap));
|
$repository = $this->repositoryManager->getRepository(IconModel::class);
|
||||||
|
$collection = $repository->findMultipleByIds(array_unique($amenityIconsMap));
|
||||||
$icons = [];
|
$icons = [];
|
||||||
|
|
||||||
if ($collection) {
|
if ($collection) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,6 +32,25 @@ class ReferenceLayerMapper extends AbstractLayerMapper
|
|||||||
*/
|
*/
|
||||||
protected static $type = 'reference';
|
protected static $type = 'reference';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -41,7 +61,8 @@ class ReferenceLayerMapper extends AbstractLayerMapper
|
|||||||
$elementId = null,
|
$elementId = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
$reference = LayerModel::findByPk($model->reference);
|
$repository = $this->repositoryManager->getRepository(LayerModel::class);
|
||||||
|
$reference = $repository->findByPk($model->reference);
|
||||||
|
|
||||||
if (!$reference || !$reference->active) {
|
if (!$reference || !$reference->active) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
|||||||
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
||||||
@@ -39,6 +40,25 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
*/
|
*/
|
||||||
protected static $type = 'vectors';
|
protected static $type = 'vectors';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -159,7 +179,9 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
*/
|
*/
|
||||||
protected function loadVectorModels(Model $model)
|
protected function loadVectorModels(Model $model)
|
||||||
{
|
{
|
||||||
return VectorModel::findActiveBy('pid', $model->id, ['order' => 'sorting']);
|
$repository = $this->repositoryManager->getRepository(VectorModel::class);
|
||||||
|
|
||||||
|
return $repository->findActiveBy(['pid=?'], [$model->id], ['order' => 'sorting']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper;
|
|||||||
use Contao\Model;
|
use Contao\Model;
|
||||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Control;
|
use Netzmacht\LeafletPHP\Definition\Control;
|
||||||
use Netzmacht\LeafletPHP\Definition\Layer;
|
use Netzmacht\LeafletPHP\Definition\Layer;
|
||||||
@@ -41,6 +42,25 @@ class MapMapper extends AbstractMapper
|
|||||||
*/
|
*/
|
||||||
protected static $definitionClass = Map::class;
|
protected static $definitionClass = Map::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -121,7 +141,8 @@ class MapMapper extends AbstractMapper
|
|||||||
*/
|
*/
|
||||||
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, Request $request = null)
|
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, Request $request = null)
|
||||||
{
|
{
|
||||||
$collection = ControlModel::findActiveBy('pid', $model->id, ['order' => 'sorting']);
|
$repository = $this->repositoryManager->getRepository(ControlModel::class);
|
||||||
|
$collection = $repository->findActiveBy(['pid=?'], [$model->id], ['order' => 'sorting']);
|
||||||
|
|
||||||
if (!$collection) {
|
if (!$collection) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Type;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Type;
|
||||||
|
|
||||||
|
use Contao\FilesModel;
|
||||||
use Contao\Model;
|
use Contao\Model;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||||
|
|
||||||
@@ -40,6 +42,25 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
*/
|
*/
|
||||||
protected static $type = 'image';
|
protected static $type = 'image';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
*/
|
||||||
|
public function __construct(RepositoryManager $repositoryManager)
|
||||||
|
{
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +73,8 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||||
|
|
||||||
if ($model->iconImage) {
|
if ($model->iconImage) {
|
||||||
$file = \FilesModel::findByUuid($model->iconImage);
|
$repository = $this->repositoryManager->getRepository(FilesModel::class);
|
||||||
|
$file = $repository->findByUuid($model->iconImage);
|
||||||
|
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$arguments[] = $file->path;
|
$arguments[] = $file->path;
|
||||||
@@ -88,8 +110,10 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
*/
|
*/
|
||||||
private function addIcon(ImageIcon $definition, IconModel $model)
|
private function addIcon(ImageIcon $definition, IconModel $model)
|
||||||
{
|
{
|
||||||
|
$repository = $this->repositoryManager->getRepository(FilesModel::class);
|
||||||
|
|
||||||
if ($model->iconImage) {
|
if ($model->iconImage) {
|
||||||
$file = \FilesModel::findByUuid($model->iconImage);
|
$file = $repository->findByUuid($model->iconImage);
|
||||||
|
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$definition->setIconUrl($file->path);
|
$definition->setIconUrl($file->path);
|
||||||
@@ -112,7 +136,7 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($model->iconRetinaImage) {
|
if ($model->iconRetinaImage) {
|
||||||
$file = \FilesModel::findByUuid($model->iconRetinaImage);
|
$file = $repository->findByUuid($model->iconRetinaImage);
|
||||||
|
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$definition->setIconRetinaUrl($file->path);
|
$definition->setIconRetinaUrl($file->path);
|
||||||
@@ -130,8 +154,10 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
*/
|
*/
|
||||||
private function addShadow(ImageIcon $definition, $model)
|
private function addShadow(ImageIcon $definition, $model)
|
||||||
{
|
{
|
||||||
|
$repository = $this->repositoryManager->getRepository(FilesModel::class);
|
||||||
|
|
||||||
if ($model->shadowImage) {
|
if ($model->shadowImage) {
|
||||||
$file = \FilesModel::findByUuid($model->shadowImage);
|
$file = $repository->findByUuid($model->shadowImage);
|
||||||
|
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$definition->setShadowUrl($file->path);
|
$definition->setShadowUrl($file->path);
|
||||||
@@ -150,7 +176,8 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($model->shadowRetinaImage) {
|
if ($model->shadowRetinaImage) {
|
||||||
$file = \FilesModel::findByUuid($model->shadowRetinaImage);
|
|
||||||
|
$file = $repository->findByUuid($model->shadowRetinaImage);
|
||||||
|
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$definition->setShadowRetinaUrl($file->path);
|
$definition->setShadowRetinaUrl($file->path);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use Netzmacht\Contao\Leaflet\Mapper\Request;
|
|||||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||||
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
||||||
@@ -53,16 +54,25 @@ class MarkerMapper extends AbstractMapper
|
|||||||
*/
|
*/
|
||||||
protected $valueFilter;
|
protected $valueFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
*
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
* @param ValueFilter $valueFilter Frontend filter.
|
* @param ValueFilter $valueFilter Frontend filter.
|
||||||
*/
|
*/
|
||||||
public function __construct(ValueFilter $valueFilter)
|
public function __construct(RepositoryManager $repositoryManager, ValueFilter $valueFilter)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
$this->valueFilter = $valueFilter;
|
$this->valueFilter = $valueFilter;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,7 +118,8 @@ class MarkerMapper extends AbstractMapper
|
|||||||
$content = $this->valueFilter->filter($model->popupContent);
|
$content = $this->valueFilter->filter($model->popupContent);
|
||||||
|
|
||||||
if ($model->popup) {
|
if ($model->popup) {
|
||||||
$popupModel = PopupModel::findActiveByPK($model->popup);
|
$popupRepository = $this->repositoryManager->getRepository(PopupModel::class);
|
||||||
|
$popupModel = $popupRepository->findActiveByPK($model->popup);
|
||||||
|
|
||||||
if ($popupModel) {
|
if ($popupModel) {
|
||||||
$popup = $mapper->handle($popupModel, $request, null, $definition);
|
$popup = $mapper->handle($popupModel, $request, null, $definition);
|
||||||
@@ -123,7 +134,8 @@ class MarkerMapper extends AbstractMapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($model->customIcon) {
|
if ($model->customIcon) {
|
||||||
$iconModel = IconModel::findBy(
|
$iconRepository = $this->repositoryManager->getRepository(IconModel::class);
|
||||||
|
$iconModel = $iconRepository->findBy(
|
||||||
['id=?', 'active=1'],
|
['id=?', 'active=1'],
|
||||||
[$model->icon],
|
[$model->icon],
|
||||||
['return' => 'Model']
|
['return' => 'Model']
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use Netzmacht\Contao\Leaflet\Mapper\Request;
|
|||||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\HasPopup;
|
use Netzmacht\LeafletPHP\Definition\HasPopup;
|
||||||
use Netzmacht\LeafletPHP\Definition\UI\Popup;
|
use Netzmacht\LeafletPHP\Definition\UI\Popup;
|
||||||
@@ -47,16 +48,25 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
|||||||
*/
|
*/
|
||||||
protected $valueFilter;
|
protected $valueFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository manager.
|
||||||
|
*
|
||||||
|
* @var RepositoryManager
|
||||||
|
*/
|
||||||
|
private $repositoryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
*
|
*
|
||||||
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
* @param ValueFilter $valueFilter Frontend filter.
|
* @param ValueFilter $valueFilter Frontend filter.
|
||||||
*/
|
*/
|
||||||
public function __construct(ValueFilter $valueFilter)
|
public function __construct(RepositoryManager $repositoryManager, ValueFilter $valueFilter)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
|
||||||
$this->valueFilter = $valueFilter;
|
$this->valueFilter = $valueFilter;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +82,8 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
|||||||
parent::build($definition, $model, $mapper, $request);
|
parent::build($definition, $model, $mapper, $request);
|
||||||
|
|
||||||
if ($definition instanceof Path && $model->style) {
|
if ($definition instanceof Path && $model->style) {
|
||||||
$styleModel = StyleModel::findActiveByPK($model->style);
|
$repository = $this->repositoryManager->getRepository(StyleModel::class);
|
||||||
|
$styleModel = $repository->findActiveByPK($model->style);
|
||||||
|
|
||||||
if ($styleModel) {
|
if ($styleModel) {
|
||||||
$style = $mapper->handle($styleModel);
|
$style = $mapper->handle($styleModel);
|
||||||
@@ -107,7 +118,8 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
|||||||
$content = $this->valueFilter->filter($model->popupContent);
|
$content = $this->valueFilter->filter($model->popupContent);
|
||||||
|
|
||||||
if ($model->popup) {
|
if ($model->popup) {
|
||||||
$popupModel = PopupModel::findActiveByPK($model->popup);
|
$repository = $this->repositoryManager->getRepository(PopupModel::class);
|
||||||
|
$popupModel = $repository->findActiveByPK($model->popup);
|
||||||
|
|
||||||
if ($popupModel) {
|
if ($popupModel) {
|
||||||
$popup = $mapper->handle($popupModel, $request, null, $definition);
|
$popup = $mapper->handle($popupModel, $request, null, $definition);
|
||||||
|
|||||||
Reference in New Issue
Block a user