mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-30 03:54:10 +01:00
Lowercasee L.contao.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
L.Contao = new (L.Class.extend({
|
L.contao = new (L.Class.extend({
|
||||||
includes: L.Mixin.Events,
|
includes: L.Mixin.Events,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +33,7 @@ L.Contao = new (L.Class.extend({
|
|||||||
* @param id The map id.
|
* @param id The map id.
|
||||||
* @param map The map object.
|
* @param map The map object.
|
||||||
*
|
*
|
||||||
* @returns {L.Contao}
|
* @returns {L.contao}
|
||||||
*/
|
*/
|
||||||
addMap: function (id, map) {
|
addMap: function (id, map) {
|
||||||
map.map.attributionControl.setPrefix(map.map.attributionControl.options.prefix + this.attribution);
|
map.map.attributionControl.setPrefix(map.map.attributionControl.options.prefix + this.attribution);
|
||||||
@@ -66,7 +66,7 @@ L.Contao = new (L.Class.extend({
|
|||||||
* @param id The icon id.
|
* @param id The icon id.
|
||||||
* @param icon The icon object.
|
* @param icon The icon object.
|
||||||
*
|
*
|
||||||
* @returns {L.Contao}
|
* @returns {L.contao}
|
||||||
*/
|
*/
|
||||||
addIcon: function(id, icon) {
|
addIcon: function(id, icon) {
|
||||||
this.icons[id] = icon;
|
this.icons[id] = icon;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<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
|
<?php $GLOBALS['TL_BODY'][] = <<<HTML
|
||||||
<script>
|
<script>
|
||||||
L.Contao.addMap('{$mapId}', function() {
|
L.contao.addMap('{$mapId}', function() {
|
||||||
{$javascript}
|
{$javascript}
|
||||||
return { map: map, layers: layers, controls: controls, icons: icons };
|
return { map: map, layers: layers, controls: controls, icons: icons };
|
||||||
}());</script>
|
}());</script>
|
||||||
HTML;
|
HTML;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
L.Contao.addMap('<?php echo $mapId; ?>', function() {
|
L.contao.addMap('<?php echo $mapId; ?>', function() {
|
||||||
<?php echo $javascript; ?>
|
<?php echo $javascript; ?>
|
||||||
|
|
||||||
return { map: map, layers: layers, controls: controls, icons: icons };
|
return { map: map, layers: layers, controls: controls, icons: icons };
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class BootSubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($icons) {
|
if ($icons) {
|
||||||
$buffer = sprintf('L.Contao.loadIcons(%s);', json_encode($icons));
|
$buffer = sprintf('L.contao.loadIcons(%s);', json_encode($icons));
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = new \File('assets/leaflet/js/icons.js');
|
$file = new \File('assets/leaflet/js/icons.js');
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ class EncoderSubscriber implements EventSubscriberInterface
|
|||||||
$value = $event->getObject();
|
$value = $event->getObject();
|
||||||
|
|
||||||
if ($value instanceof Icon) {
|
if ($value instanceof Icon) {
|
||||||
$event->setReference('L.Contao.getIcon(\'' . $value->getId() . '\')');
|
$event->setReference('L.contao.getIcon(\'' . $value->getId() . '\')');
|
||||||
$event->stopPropagation();
|
$event->stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force that icons are encoded as reference to the L.Contao icon registry.
|
* Force that icons are encoded as reference to the L.contao icon registry.
|
||||||
*
|
*
|
||||||
* @param EncodeValueEvent $event The subscribed event.
|
* @param EncodeValueEvent $event The subscribed event.
|
||||||
*
|
*
|
||||||
@@ -64,7 +64,7 @@ class EncoderSubscriber implements EventSubscriberInterface
|
|||||||
$value = $event->getValue();
|
$value = $event->getValue();
|
||||||
|
|
||||||
if ($value instanceof Icon) {
|
if ($value instanceof Icon) {
|
||||||
//$event->addLine('L.Contao.getIcon(\'' . $value->getId() . '\')');
|
//$event->addLine('L.contao.getIcon(\'' . $value->getId() . '\')');
|
||||||
$event->setSuccessful();
|
$event->setSuccessful();
|
||||||
$event->stopPropagation();
|
$event->stopPropagation();
|
||||||
}
|
}
|
||||||
@@ -85,11 +85,11 @@ class EncoderSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
$event->addLine(
|
$event->addLine(
|
||||||
sprintf(
|
sprintf(
|
||||||
'%s = L.Contao.loadLayer(%s, %s, %s, %s, map);',
|
'%s = L.contao.loadLayer(%s, %s, %s, %s, map);',
|
||||||
$ref,
|
$ref,
|
||||||
$encoder->encodeValue($url),
|
$encoder->encodeValue($url),
|
||||||
$encoder->encodeValue(strtolower(str_replace('Omnivore.', '', $value->getType()))),
|
$encoder->encodeValue(strtolower(str_replace('Omnivore.', '', $value->getType()))),
|
||||||
$encoder->encodeValue($value->getOptions()),
|
$encoder->encodeArray($value->getOptions(), JSON_FORCE_OBJECT),
|
||||||
$this->encodeCustomLayer($value, $encoder)
|
$this->encodeCustomLayer($value, $encoder)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user