diff --git a/src/Bundle/Resources/config/listeners.yml b/src/Bundle/Resources/config/listeners.yml index 692bc00..645d717 100644 --- a/src/Bundle/Resources/config/listeners.yml +++ b/src/Bundle/Resources/config/listeners.yml @@ -4,7 +4,7 @@ services: public: true arguments: - '@netzmacht.contao_toolkit.repository_manager' - - '@templating' + - '@netzmacht.contao_toolkit.template_renderer' - '@filesystem' - '@netzmacht.contao_toolkit.contao.system_adapter' - '%netzmacht.contao_leaflet.cache_dir%' diff --git a/src/Bundle/Resources/config/services.yml b/src/Bundle/Resources/config/services.yml index 05d9769..66cbab6 100644 --- a/src/Bundle/Resources/config/services.yml +++ b/src/Bundle/Resources/config/services.yml @@ -16,7 +16,7 @@ services: - '@netzmacht.contao_leaflet.cache' - '@netzmacht.contao_leaflet.frontend.data_controller' - '@netzmacht.contao_toolkit.repository_manager' - - '@templating' + - '@netzmacht.contao_toolkit.template_renderer' netzmacht.contao_leaflet.libraries: class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration @@ -141,4 +141,4 @@ services: Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin: tags: - - { name: hofff_contao_consent_bridge.plugin } \ No newline at end of file + - { name: hofff_contao_consent_bridge.plugin } diff --git a/src/Listener/Dca/LeafletDcaListener.php b/src/Listener/Dca/LeafletDcaListener.php index 871574c..f802caf 100644 --- a/src/Listener/Dca/LeafletDcaListener.php +++ b/src/Listener/Dca/LeafletDcaListener.php @@ -17,9 +17,9 @@ use Contao\DataContainer; use Contao\System; use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; +use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer; use Netzmacht\LeafletPHP\Value\LatLng; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Templating\EngineInterface as TemplateEngine; /** * Class Leaflet is the base helper providing different methods. @@ -50,11 +50,11 @@ class LeafletDcaListener private $repositoryManager; /** - * Template engine. + * Template renderer. * - * @var TemplateEngine + * @var TemplateRenderer */ - private $templateEngine; + private $templateRenderer; /** * System adapter. @@ -67,20 +67,20 @@ class LeafletDcaListener * LeafletCallbacks constructor. * * @param RepositoryManager $repositoryManager Repository manager. - * @param TemplateEngine $templateEngine Template engine. + * @param TemplateRenderer $templateRenderer Template renderer. * @param Filesystem $fileSystem File system. * @param Adapter|System $systemAdapter Contao system adapter. * @param string $cacheDir Cache dir. */ public function __construct( RepositoryManager $repositoryManager, - TemplateEngine $templateEngine, + TemplateRenderer $templateRenderer, Filesystem $fileSystem, $systemAdapter, string $cacheDir ) { $this->repositoryManager = $repositoryManager; - $this->templateEngine = $templateEngine; + $this->templateRenderer = $templateRenderer; $this->fileSystem = $fileSystem; $this->systemAdapter = $systemAdapter; $this->cacheDir = $cacheDir; @@ -125,7 +125,7 @@ class LeafletDcaListener $data['marker'] = null; } - return $this->templateEngine->render('toolkit:be:be_leaflet_geocode.html5', $data); + return $this->templateRenderer->render('be:be_leaflet_geocode', $data); } /** diff --git a/src/MapProvider.php b/src/MapProvider.php index 89a6ba1..192a80c 100644 --- a/src/MapProvider.php +++ b/src/MapProvider.php @@ -24,10 +24,10 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Leaflet\Model\MapModel; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\View\Template\TemplateReference; +use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer; use Netzmacht\LeafletPHP\Definition\Map; use Netzmacht\LeafletPHP\Leaflet; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; -use Symfony\Component\Templating\EngineInterface as TemplateEngine; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher; /** @@ -94,11 +94,11 @@ class MapProvider private $repositoryManager; /** - * Template engine. + * Template renderer. * - * @var TemplateEngine + * @var TemplateRenderer */ - private $templateEngine; + private $templateRenderer; /** * Construct. @@ -111,7 +111,7 @@ class MapProvider * @param Cache $cache Cache. * @param DataController $dataController Data controller. * @param RepositoryManager $repositoryManager Repository manager. - * @param TemplateEngine $templateEngine Template engine. + * @param TemplateRenderer $templateRenderer Template rednerer. */ public function __construct( DefinitionMapper $mapper, @@ -122,7 +122,7 @@ class MapProvider Cache $cache, DataController $dataController, RepositoryManager $repositoryManager, - TemplateEngine $templateEngine + TemplateRenderer $templateRenderer ) { $this->mapper = $mapper; $this->leaflet = $leaflet; @@ -132,7 +132,7 @@ class MapProvider $this->cache = $cache; $this->dataController = $dataController; $this->repositoryManager = $repositoryManager; - $this->templateEngine = $templateEngine; + $this->templateRenderer = $templateRenderer; } /** @@ -374,7 +374,7 @@ class MapProvider $javascript = $this->leaflet->build($definition, $this->assets); $mapId = $definition->getId(); - $templateReference = new TemplateReference($template, 'html5', TemplateReference::SCOPE_FRONTEND); + $templateReference = 'fe:' . $template; $parameters = [ 'definition' => $definition, 'model' => $model, @@ -384,7 +384,7 @@ class MapProvider 'mapId' => $mapId, ]; - $content = $this->templateEngine->render($templateReference, $parameters); + $content = $this->templateRenderer->render($templateReference, $parameters); $content = preg_replace( ['/^\n*/', '/\n*$/'], '',