mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-01 12:33:45 +01:00
Refactor the insert tag replacer.
This commit is contained in:
@@ -16,9 +16,11 @@ use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent;
|
||||
use Netzmacht\Contao\Leaflet\Event\InitializeDefinitionMapperEvent;
|
||||
use Netzmacht\Contao\Leaflet\Event\InitializeEventDispatcherEvent;
|
||||
use Netzmacht\Contao\Leaflet\Event\InitializeLeafletBuilderEvent;
|
||||
use Netzmacht\Contao\Leaflet\Frontend\InsertTag\LeafletInsertTagParser;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\Mapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\Contao\Toolkit\Event\InitializeSystemEvent;
|
||||
use Netzmacht\LeafletPHP\Assets;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
@@ -36,6 +38,7 @@ class BootSubscriber implements EventSubscriberInterface
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
InitializeSystemEvent::NAME => 'initializeInsertTagParser',
|
||||
InitializeDefinitionMapperEvent::NAME => 'initializeDefinitionMapper',
|
||||
InitializeEventDispatcherEvent::NAME => 'initializeEventDispatcher',
|
||||
InitializeLeafletBuilderEvent::NAME => 'initializeLeafletBuilder',
|
||||
@@ -43,6 +46,23 @@ class BootSubscriber implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the leaflet insert tag parser.
|
||||
*
|
||||
* @param InitializeSystemEvent $event The event.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initializeInsertTagParser(InitializeSystemEvent $event)
|
||||
{
|
||||
$container = $event->getServiceContainer();
|
||||
$debugMode = $container->getConfig()->get('debugMode');
|
||||
$mapService = $container->getService('leaflet.map.service');
|
||||
$parser = new LeafletInsertTagParser($mapService, $debugMode);
|
||||
|
||||
$container->getInsertTagReplacer()->registerParser($parser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and register all configured mappers.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user