Small fixed.

This commit is contained in:
David Molineus
2015-01-12 15:11:35 +01:00
parent 58b370b22a
commit 4dc6b396da
4 changed files with 23 additions and 5 deletions

View File

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

View File

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