From 4dc6b396dafc7d479422a3eee172a71dc850f5dd Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 12 Jan 2015 15:11:35 +0100 Subject: [PATCH] Small fixed. --- .check-author.yml | 3 +++ module/languages/en/tl_leaflet_layer.php | 2 +- .../Mapper/Layer/VectorsLayerMapper.php | 2 +- .../Leaflet/Subscriber/EncoderSubscriber.php | 21 ++++++++++++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 .check-author.yml diff --git a/.check-author.yml b/.check-author.yml new file mode 100644 index 0000000..f0ecfba --- /dev/null +++ b/.check-author.yml @@ -0,0 +1,3 @@ + +exclude: + languages diff --git a/module/languages/en/tl_leaflet_layer.php b/module/languages/en/tl_leaflet_layer.php index 64ea661..60b3a11 100644 --- a/module/languages/en/tl_leaflet_layer.php +++ b/module/languages/en/tl_leaflet_layer.php @@ -39,7 +39,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_variant'][1] = 'Tile vari $GLOBALS['TL_LANG']['tl_leaflet_layer']['active'][0] = 'Activate layer'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['active'][1] = 'Activate layer on the map.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][0] = 'Reference'; -$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][1] = 'Choose the reference layer.'; +$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][1] = 'Choose the reference layer. Otherwise the same javscript object is used.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone'][0] = 'Standalone'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone'][1] = 'Integrate reference as a copy of the referenced layer.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster'][0] = 'Marker cluster'; diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php index 6e8b1ef..ebb1666 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php @@ -75,7 +75,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper } } - if ($definition instanceof GeoJson) { + if ($definition instanceof GeoJson || $definition instanceof GeoJsonAjax) { if ($model->pointToLayer) { $definition->setPointToLayer(new Expression($model->pointToLayer)); } diff --git a/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php b/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php index 3d2d2b6..0d8bc9b 100644 --- a/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php +++ b/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php @@ -12,7 +12,9 @@ namespace Netzmacht\Contao\Leaflet\Subscriber; use Netzmacht\Javascript\Event\BuildEvent; +use Netzmacht\Javascript\Event\EncodeValueEvent; use Netzmacht\LeafletPHP\Definition\Map; +use Netzmacht\LeafletPHP\Definition\Type\Icon; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -29,9 +31,12 @@ class EncoderSubscriber implements EventSubscriberInterface { return array( BuildEvent::NAME => array( - array('startWrapper', 1000), - array('endWrapper', -1000) - ) + array('startWrapper', 100), + array('endWrapper', -100), + ), + EncodeValueEvent::NAME => array( + array('encodeIcons', 100) + ), ); } @@ -71,4 +76,14 @@ class EncoderSubscriber implements EventSubscriberInterface $event->getOutput()->addLine($line); } } + + public function encodeIcons(EncodeValueEvent $event) + { + $value = $event->getValue(); + + if ($value instanceof Icon) { + $event->addLine('ContaoLeaflet.getIcon(\'' . $value->getId() . '\')'); + $event->stopPropagation(); + } + } }