mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-30 20:13:49 +01:00
Restructure config files, add extension and complete mappers services.
This commit is contained in:
51
src/DependencyInjection/NetzmachtContaoLeafletExtension.php
Normal file
51
src/DependencyInjection/NetzmachtContaoLeafletExtension.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leaflet maps for Contao CMS.
|
||||||
|
*
|
||||||
|
* @package contao-leaflet-maps
|
||||||
|
* @author David Molineus <david.molineus@netzmacht.de>
|
||||||
|
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||||
|
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||||
|
* @filesource
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Netzmacht\Contao\Leaflet\DependencyInjection;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class NetzmachtContaoLeafletExtension.
|
||||||
|
*
|
||||||
|
* @package Netzmacht\Contao\Leaflet\DependencyInjection
|
||||||
|
*/
|
||||||
|
class NetzmachtContaoLeafletExtension extends Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$loader = new YamlFileLoader(
|
||||||
|
$container,
|
||||||
|
new FileLocator(dirname(__DIR__) .'/Resources/config')
|
||||||
|
);
|
||||||
|
|
||||||
|
// Common config, services and listeners
|
||||||
|
$loader->load('config.yml');
|
||||||
|
$loader->load('services.yml');
|
||||||
|
$loader->load('listeners.yml');
|
||||||
|
|
||||||
|
// Amenities and providers config
|
||||||
|
$loader->load('amenities.yml');
|
||||||
|
$loader->load('providers.yml');
|
||||||
|
|
||||||
|
// Other services
|
||||||
|
$loader->load('filters.yml');
|
||||||
|
$loader->load('mappers.yml');
|
||||||
|
$loader->load('encoders.yml');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,60 @@
|
|||||||
imports:
|
parameters:
|
||||||
- { resource: parameters/common.yml }
|
# leaflet controls.
|
||||||
- { resource: parameters/amenities.yml }
|
#
|
||||||
- { resource: parameters/providers.yml }
|
# Supported leaflet control types. Register your type for the database driven definition here.
|
||||||
- { resource: services/encoders.yml }
|
netzmacht.contao_leaflet_maps.controls:
|
||||||
- { resource: services/mappers.yml }
|
- 'zoom'
|
||||||
- { resource: services/services.yml }
|
- 'layers'
|
||||||
- { resource: services/listeners.yml }
|
- 'scale'
|
||||||
|
- 'attribution'
|
||||||
|
- 'loading'
|
||||||
|
- 'fullscreen'
|
||||||
|
|
||||||
|
# Leaflet icons.
|
||||||
|
#
|
||||||
|
# Supported leaflet icon types. Register you type for the database driven definition here.
|
||||||
|
netzmacht.contao_leaflet_maps.icons:
|
||||||
|
- 'image'
|
||||||
|
- 'div'
|
||||||
|
- 'extra'
|
||||||
|
|
||||||
|
# The style concept is not part of the LeafletJS library. Styles are extracted from the Path options. Instead
|
||||||
|
# of defining the style for every vector again, manage them at one place.
|
||||||
|
#
|
||||||
|
# The goal is to provide different style strategies. For instance a random style chooser, one which uses a color
|
||||||
|
# range and so one.
|
||||||
|
netzmacht.contao_leaflet_maps.styles:
|
||||||
|
- 'fixed'
|
||||||
|
|
||||||
|
# Leaflet vectors.
|
||||||
|
#
|
||||||
|
# Supported leaflet vector types. Register you type for the database driven definition here.
|
||||||
|
netzmacht.contao_leaflet_maps.vectors:
|
||||||
|
- 'polyline'
|
||||||
|
- 'polygon'
|
||||||
|
- 'multiPolyline'
|
||||||
|
- 'multiPolygon'
|
||||||
|
- 'rectangle'
|
||||||
|
- 'circle'
|
||||||
|
- 'circleMarker'
|
||||||
|
|
||||||
|
# When creating a GeoJSON feature of a map object a feature.properties.model object is passed.
|
||||||
|
# Define the properties you always want to set.
|
||||||
|
#
|
||||||
|
# For more control you can subscribe the ConvertToGeoJsonEvent.
|
||||||
|
#
|
||||||
|
# The entry can be a string or an array. If an array is passed, the 2nd value is the type. Following types
|
||||||
|
# are supported.
|
||||||
|
# - array: Use deserialize before adding the value
|
||||||
|
# - file: Thread value a uuid and find the path.
|
||||||
|
# - files: Thread values as a list of file uuids and get an array of paths.
|
||||||
|
netzmacht.contao_leaflet_maps.feature_model_properties:
|
||||||
|
tl_leaflet_marker:
|
||||||
|
- 'id'
|
||||||
|
- 'title'
|
||||||
|
- 'alias'
|
||||||
|
|
||||||
|
tl_leaflet_vector:
|
||||||
|
- 'id'
|
||||||
|
- 'title'
|
||||||
|
- 'alias'
|
||||||
|
|||||||
177
src/Resources/config/mappers.yml
Normal file
177
src/Resources/config/mappers.yml
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
# Leaflet mappers.
|
||||||
|
#
|
||||||
|
# Mappers translate between the database models and the leaflet definition.
|
||||||
|
services:
|
||||||
|
_defaults:
|
||||||
|
public: false
|
||||||
|
|
||||||
|
|
||||||
|
# Map mapper
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.map:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\MapMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
|
||||||
|
# Layer mappers
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.tile_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\TileLayerMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.provider_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '%netzmacht.contao_leaflet_maps.providers%'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.markers_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.group_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\GroupLayerMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.vectors_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.reference_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\ReferenceLayerMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.overpass_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\OverpassLayerMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.marker_cluster_layer:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkerClusterLayerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.map.assets'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leflet_maps.mapper }
|
||||||
|
|
||||||
|
|
||||||
|
# Control mappers
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.zoom_control:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\ZoomControlMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.scale_control:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\ScaleControlMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.layers_control:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\LayersControlMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.attribution_control:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\AttributionControlMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.loading_control:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\LoadingControlMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.fullscreen_control:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Control\FullscreenControlMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
|
||||||
|
# Vector mappers
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.polyline:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\PolylineMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.multi_polyline:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolylineMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.polygon:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\PolygonMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.multi_polygon:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolygonMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.circle:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.circle_mapper:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMarkerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.rectangle_mapper:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Vector\RectangleMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
|
||||||
|
# Miscellaneous mappers
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.popup:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\UI\PopupMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.image_icon:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Type\ImageIconMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.div_icon:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Type\DivIconMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.extra_markers:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Type\ExtraMarkersIconMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.fixed_style:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\Style\FixedStyleMapper
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.mapper.marker:
|
||||||
|
class: Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper
|
||||||
|
arguments:
|
||||||
|
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
||||||
|
tags:
|
||||||
|
- { name: netzmacht.contao_leaflet_maps.mapper }
|
||||||
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
parameters:
|
|
||||||
# leaflet controls.
|
|
||||||
#
|
|
||||||
# Supported leaflet control types. Register your type for the database driven definition here.
|
|
||||||
netzmacht.contao_leaflet_maps.controls:
|
|
||||||
- 'zoom'
|
|
||||||
- 'layers'
|
|
||||||
- 'scale'
|
|
||||||
- 'attribution'
|
|
||||||
- 'loading'
|
|
||||||
- 'fullscreen'
|
|
||||||
|
|
||||||
# Leaflet icons.
|
|
||||||
#
|
|
||||||
# Supported leaflet icon types. Register you type for the database driven definition here.
|
|
||||||
netzmacht.contao_leaflet_maps.icons:
|
|
||||||
- 'image'
|
|
||||||
- 'div'
|
|
||||||
- 'extra'
|
|
||||||
|
|
||||||
# The style concept is not part of the LeafletJS library. Styles are extracted from the Path options. Instead
|
|
||||||
# of defining the style for every vector again, manage them at one place.
|
|
||||||
#
|
|
||||||
# The goal is to provide different style strategies. For instance a random style chooser, one which uses a color
|
|
||||||
# range and so one.
|
|
||||||
netzmacht.contao_leaflet_maps.styles:
|
|
||||||
- 'fixed'
|
|
||||||
|
|
||||||
# Leaflet vectors.
|
|
||||||
#
|
|
||||||
# Supported leaflet vector types. Register you type for the database driven definition here.
|
|
||||||
netzmacht.contao_leaflet_maps.vectors:
|
|
||||||
- 'polyline'
|
|
||||||
- 'polygon'
|
|
||||||
- 'multiPolyline'
|
|
||||||
- 'multiPolygon'
|
|
||||||
- 'rectangle'
|
|
||||||
- 'circle'
|
|
||||||
- 'circleMarker'
|
|
||||||
|
|
||||||
# When creating a GeoJSON feature of a map object a feature.properties.model object is passed.
|
|
||||||
# Define the properties you always want to set.
|
|
||||||
#
|
|
||||||
# For more control you can subscribe the ConvertToGeoJsonEvent.
|
|
||||||
#
|
|
||||||
# The entry can be a string or an array. If an array is passed, the 2nd value is the type. Following types
|
|
||||||
# are supported.
|
|
||||||
# - array: Use deserialize before adding the value
|
|
||||||
# - file: Thread value a uuid and find the path.
|
|
||||||
# - files: Thread values as a list of file uuids and get an array of paths.
|
|
||||||
netzmacht.contao_leaflet_maps.feature_model_properties:
|
|
||||||
tl_leaflet_marker:
|
|
||||||
- 'id'
|
|
||||||
- 'title'
|
|
||||||
- 'alias'
|
|
||||||
|
|
||||||
tl_leaflet_vector:
|
|
||||||
- 'id'
|
|
||||||
- 'title'
|
|
||||||
- 'alias'
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
netzmacht.contao_leaflet_maps.frontend.value_filter:
|
netzmacht.contao_leaflet_maps.frontend.value_filter:
|
||||||
class:
|
class:
|
||||||
|
|
||||||
|
netzmacht.contao_leaflet_maps.map.assets:
|
||||||
|
class:
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
services:
|
|
||||||
netzmacht.contao_leaflet_maps.mapper.popup:
|
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\UI\PopupMapper
|
|
||||||
tags:
|
|
||||||
- { name: netzmacht.contao_leaflet_maps.mapper }
|
|
||||||
|
|
||||||
netzmacht.contao_leaflet_maps.mapper.image_icon:
|
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Type\ImageIconMapper
|
|
||||||
tags:
|
|
||||||
- { name: netzmacht.contao_leaflet_maps.mapper }
|
|
||||||
|
|
||||||
netzmacht.contao_leaflet_maps.mapper.div_icon:
|
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Type\DivIconMapper
|
|
||||||
tags:
|
|
||||||
- { name: netzmacht.contao_leaflet_maps.mapper }
|
|
||||||
|
|
||||||
netzmacht.contao_leaflet_maps.mapper.extra_markers:
|
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Type\ExtraMarkersIconMapper
|
|
||||||
tags:
|
|
||||||
- { name: netzmacht.contao_leaflet_maps.mapper }
|
|
||||||
|
|
||||||
netzmacht.contao_leaflet_maps.mapper.fixed_style:
|
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\Style\FixedStyleMapper
|
|
||||||
tags:
|
|
||||||
- { name: netzmacht.contao_leaflet_maps.mapper }
|
|
||||||
|
|
||||||
netzmacht.contao_leaflet_maps.mapper.marker:
|
|
||||||
class: Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper
|
|
||||||
arguments:
|
|
||||||
- '@netzmacht.contao_leaflet_maps.frontend.value_filter'
|
|
||||||
tags:
|
|
||||||
- { name: netzmacht.contao_leaflet_maps.mapper }
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user