mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-01 04:24:02 +01:00
Do not use templating engine where not required
This commit is contained in:
@@ -4,7 +4,7 @@ services:
|
|||||||
public: true
|
public: true
|
||||||
arguments:
|
arguments:
|
||||||
- '@netzmacht.contao_toolkit.repository_manager'
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@templating'
|
- '@netzmacht.contao_toolkit.template_renderer'
|
||||||
- '@filesystem'
|
- '@filesystem'
|
||||||
- '@netzmacht.contao_toolkit.contao.system_adapter'
|
- '@netzmacht.contao_toolkit.contao.system_adapter'
|
||||||
- '%netzmacht.contao_leaflet.cache_dir%'
|
- '%netzmacht.contao_leaflet.cache_dir%'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ services:
|
|||||||
- '@netzmacht.contao_leaflet.cache'
|
- '@netzmacht.contao_leaflet.cache'
|
||||||
- '@netzmacht.contao_leaflet.frontend.data_controller'
|
- '@netzmacht.contao_leaflet.frontend.data_controller'
|
||||||
- '@netzmacht.contao_toolkit.repository_manager'
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
- '@templating'
|
- '@netzmacht.contao_toolkit.template_renderer'
|
||||||
|
|
||||||
netzmacht.contao_leaflet.libraries:
|
netzmacht.contao_leaflet.libraries:
|
||||||
class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration
|
class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration
|
||||||
@@ -141,4 +141,4 @@ services:
|
|||||||
|
|
||||||
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
|
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
|
||||||
tags:
|
tags:
|
||||||
- { name: hofff_contao_consent_bridge.plugin }
|
- { name: hofff_contao_consent_bridge.plugin }
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ use Contao\DataContainer;
|
|||||||
use Contao\System;
|
use Contao\System;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
|
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
|
||||||
use Netzmacht\LeafletPHP\Value\LatLng;
|
use Netzmacht\LeafletPHP\Value\LatLng;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Leaflet is the base helper providing different methods.
|
* Class Leaflet is the base helper providing different methods.
|
||||||
@@ -50,11 +50,11 @@ class LeafletDcaListener
|
|||||||
private $repositoryManager;
|
private $repositoryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template engine.
|
* Template renderer.
|
||||||
*
|
*
|
||||||
* @var TemplateEngine
|
* @var TemplateRenderer
|
||||||
*/
|
*/
|
||||||
private $templateEngine;
|
private $templateRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System adapter.
|
* System adapter.
|
||||||
@@ -67,20 +67,20 @@ class LeafletDcaListener
|
|||||||
* LeafletCallbacks constructor.
|
* LeafletCallbacks constructor.
|
||||||
*
|
*
|
||||||
* @param RepositoryManager $repositoryManager Repository manager.
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
* @param TemplateEngine $templateEngine Template engine.
|
* @param TemplateRenderer $templateRenderer Template renderer.
|
||||||
* @param Filesystem $fileSystem File system.
|
* @param Filesystem $fileSystem File system.
|
||||||
* @param Adapter|System $systemAdapter Contao system adapter.
|
* @param Adapter|System $systemAdapter Contao system adapter.
|
||||||
* @param string $cacheDir Cache dir.
|
* @param string $cacheDir Cache dir.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
RepositoryManager $repositoryManager,
|
RepositoryManager $repositoryManager,
|
||||||
TemplateEngine $templateEngine,
|
TemplateRenderer $templateRenderer,
|
||||||
Filesystem $fileSystem,
|
Filesystem $fileSystem,
|
||||||
$systemAdapter,
|
$systemAdapter,
|
||||||
string $cacheDir
|
string $cacheDir
|
||||||
) {
|
) {
|
||||||
$this->repositoryManager = $repositoryManager;
|
$this->repositoryManager = $repositoryManager;
|
||||||
$this->templateEngine = $templateEngine;
|
$this->templateRenderer = $templateRenderer;
|
||||||
$this->fileSystem = $fileSystem;
|
$this->fileSystem = $fileSystem;
|
||||||
$this->systemAdapter = $systemAdapter;
|
$this->systemAdapter = $systemAdapter;
|
||||||
$this->cacheDir = $cacheDir;
|
$this->cacheDir = $cacheDir;
|
||||||
@@ -125,7 +125,7 @@ class LeafletDcaListener
|
|||||||
$data['marker'] = null;
|
$data['marker'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->templateEngine->render('toolkit:be:be_leaflet_geocode.html5', $data);
|
return $this->templateRenderer->render('be:be_leaflet_geocode', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
|||||||
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||||
use Netzmacht\Contao\Toolkit\View\Template\TemplateReference;
|
use Netzmacht\Contao\Toolkit\View\Template\TemplateReference;
|
||||||
|
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
|
||||||
use Netzmacht\LeafletPHP\Definition\Map;
|
use Netzmacht\LeafletPHP\Definition\Map;
|
||||||
use Netzmacht\LeafletPHP\Leaflet;
|
use Netzmacht\LeafletPHP\Leaflet;
|
||||||
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
|
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
|
||||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
|
||||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
|
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,11 +94,11 @@ class MapProvider
|
|||||||
private $repositoryManager;
|
private $repositoryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template engine.
|
* Template renderer.
|
||||||
*
|
*
|
||||||
* @var TemplateEngine
|
* @var TemplateRenderer
|
||||||
*/
|
*/
|
||||||
private $templateEngine;
|
private $templateRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
@@ -111,7 +111,7 @@ class MapProvider
|
|||||||
* @param Cache $cache Cache.
|
* @param Cache $cache Cache.
|
||||||
* @param DataController $dataController Data controller.
|
* @param DataController $dataController Data controller.
|
||||||
* @param RepositoryManager $repositoryManager Repository manager.
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
* @param TemplateEngine $templateEngine Template engine.
|
* @param TemplateRenderer $templateRenderer Template rednerer.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
@@ -122,7 +122,7 @@ class MapProvider
|
|||||||
Cache $cache,
|
Cache $cache,
|
||||||
DataController $dataController,
|
DataController $dataController,
|
||||||
RepositoryManager $repositoryManager,
|
RepositoryManager $repositoryManager,
|
||||||
TemplateEngine $templateEngine
|
TemplateRenderer $templateRenderer
|
||||||
) {
|
) {
|
||||||
$this->mapper = $mapper;
|
$this->mapper = $mapper;
|
||||||
$this->leaflet = $leaflet;
|
$this->leaflet = $leaflet;
|
||||||
@@ -132,7 +132,7 @@ class MapProvider
|
|||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->dataController = $dataController;
|
$this->dataController = $dataController;
|
||||||
$this->repositoryManager = $repositoryManager;
|
$this->repositoryManager = $repositoryManager;
|
||||||
$this->templateEngine = $templateEngine;
|
$this->templateRenderer = $templateRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -374,7 +374,7 @@ class MapProvider
|
|||||||
$javascript = $this->leaflet->build($definition, $this->assets);
|
$javascript = $this->leaflet->build($definition, $this->assets);
|
||||||
$mapId = $definition->getId();
|
$mapId = $definition->getId();
|
||||||
|
|
||||||
$templateReference = new TemplateReference($template, 'html5', TemplateReference::SCOPE_FRONTEND);
|
$templateReference = 'fe:' . $template;
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'definition' => $definition,
|
'definition' => $definition,
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
@@ -384,7 +384,7 @@ class MapProvider
|
|||||||
'mapId' => $mapId,
|
'mapId' => $mapId,
|
||||||
];
|
];
|
||||||
|
|
||||||
$content = $this->templateEngine->render($templateReference, $parameters);
|
$content = $this->templateRenderer->render($templateReference, $parameters);
|
||||||
$content = preg_replace(
|
$content = preg_replace(
|
||||||
['/^<!-- TEMPLATE (START): .+ -->\n*/', '/\n*<!-- TEMPLATE (END): .+ -->$/'],
|
['/^<!-- TEMPLATE (START): .+ -->\n*/', '/\n*<!-- TEMPLATE (END): .+ -->$/'],
|
||||||
'',
|
'',
|
||||||
|
|||||||
Reference in New Issue
Block a user