Use template engine to render the map.

This commit is contained in:
David Molineus
2017-10-18 17:01:03 +02:00
parent 7498aef141
commit ce9de6ded3
4 changed files with 32 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ services:
- '@netzmacht.contao_leaflet.cache'
- '@netzmacht.contao_leaflet.frontend.data_controller'
- '@netzmacht.contao_toolkit.repository_manager'
- '@templating'
netzmacht.contao_leaflet.libraries:
class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration

View File

@@ -1,6 +1,7 @@
<div id="<?php echo $mapId; ?>" style="<?php echo $style; ?>"></div>
<div id="<?= $this->mapId ?>" style="<?= $this->style ?>"></div>
<script>
L.contao.addMap('<?php echo $mapId; ?>', function () {
<?php echo $javascript; ?>
L.contao.addMap('<?= $this->mapId ?>', function () {
<?= $this->javascript ?>
return {map: map, layers: layers, controls: controls, icons: icons};
}());</script>
}());
</script>

View File

@@ -1,5 +1,5 @@
L.contao.addMap('<?php echo $mapId; ?>', function() {
<?php echo $javascript; ?>
L.contao.addMap('<?= $this->mapId ?>', function() {
<?= $this->javascript ?>
return { map: map, layers: layers, controls: controls, icons: icons };
}());