mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-01 04:24:02 +01:00
Prepare for backend usage.
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
<div id="<?php echo $mapId; ?>" style="<?php echo $style; ?>"></div>
|
<div id="<?php echo $mapId; ?>" style="<?php echo $style; ?>"></div>
|
||||||
<?php $GLOBALS['TL_BODY'][] = <<<HTML
|
|
||||||
<script>
|
<script>
|
||||||
L.contao.addMap('{$mapId}', function() {
|
L.contao.addMap('{$mapId}', function() {
|
||||||
{$javascript}
|
<?php echo $javascript; ?>
|
||||||
return { map: map, layers: layers, controls: controls, icons: icons };
|
return { map: map, layers: layers, controls: controls, icons: icons };
|
||||||
}());</script>
|
}());</script>
|
||||||
HTML;
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class ContaoAssets implements Assets
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case static::TYPE_FILE:
|
case static::TYPE_FILE:
|
||||||
if (!\Config::get('debugMode')) {
|
if (!\Config::get('debugMode') && TL_MODE === 'FE') {
|
||||||
$script .= '|static';
|
$script .= '|static';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,10 +116,7 @@ class BootSubscriber implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
public function loadAssets()
|
public function loadAssets()
|
||||||
{
|
{
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/maps/contao-leaflet.js' . (\Config::get('debugMode')
|
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/maps/contao-leaflet.js' . $this->staticFlag();
|
||||||
? ''
|
|
||||||
: '|static'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,10 +157,16 @@ class BootSubscriber implements EventSubscriberInterface
|
|||||||
// @codingStandardsIgnoreStart
|
// @codingStandardsIgnoreStart
|
||||||
// TODO: Cache it.
|
// TODO: Cache it.
|
||||||
// codingStandardsIgnoreEnd
|
// codingStandardsIgnoreEnd
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/js/icons.js' . (\Config::get('debugMode')
|
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/js/icons.js' . $this->staticFlag();
|
||||||
? ''
|
|
||||||
: '|static'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function staticFlag()
|
||||||
|
{
|
||||||
|
if (\Config::get('debugMode') || TL_MODE !== 'FE') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '|static';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user