diff --git a/assets/maps/contao-leaflet.js b/assets/maps/contao-leaflet.js index d7148b7..9489062 100644 --- a/assets/maps/contao-leaflet.js +++ b/assets/maps/contao-leaflet.js @@ -1,4 +1,4 @@ -L.Contao = new (L.Class.extend({ +L.contao = new (L.Class.extend({ includes: L.Mixin.Events, /** @@ -33,7 +33,7 @@ L.Contao = new (L.Class.extend({ * @param id The map id. * @param map The map object. * - * @returns {L.Contao} + * @returns {L.contao} */ addMap: function (id, map) { 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 icon The icon object. * - * @returns {L.Contao} + * @returns {L.contao} */ addIcon: function(id, icon) { this.icons[id] = icon; diff --git a/module/templates/leaflet_map_html.html5 b/module/templates/leaflet_map_html.html5 index 303283f..7bd835a 100644 --- a/module/templates/leaflet_map_html.html5 +++ b/module/templates/leaflet_map_html.html5 @@ -1,8 +1,8 @@
-L.Contao.addMap('{$mapId}', function() { +L.contao.addMap('{$mapId}', function() { {$javascript} -return { map: map, layers: layers, controls: controls, icons: icons }; +return { map: map, layers: layers, controls: controls, icons: icons }; }()); HTML; diff --git a/module/templates/leaflet_map_js.html5 b/module/templates/leaflet_map_js.html5 index e343576..8f9f88f 100644 --- a/module/templates/leaflet_map_js.html5 +++ b/module/templates/leaflet_map_js.html5 @@ -1,5 +1,5 @@ -L.Contao.addMap('', function() { +L.contao.addMap('', function() { -return { map: map, layers: layers, controls: controls, icons: icons }; +return { map: map, layers: layers, controls: controls, icons: icons }; }()); diff --git a/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php b/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php index 499ff4c..4fdf9cf 100644 --- a/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php +++ b/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php @@ -150,7 +150,7 @@ class BootSubscriber implements EventSubscriberInterface } 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'); diff --git a/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php b/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php index f0ca75a..56a62ab 100644 --- a/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php +++ b/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php @@ -46,14 +46,14 @@ class EncoderSubscriber implements EventSubscriberInterface $value = $event->getObject(); if ($value instanceof Icon) { - $event->setReference('L.Contao.getIcon(\'' . $value->getId() . '\')'); + $event->setReference('L.contao.getIcon(\'' . $value->getId() . '\')'); $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. * @@ -64,7 +64,7 @@ class EncoderSubscriber implements EventSubscriberInterface $value = $event->getValue(); if ($value instanceof Icon) { - //$event->addLine('L.Contao.getIcon(\'' . $value->getId() . '\')'); + //$event->addLine('L.contao.getIcon(\'' . $value->getId() . '\')'); $event->setSuccessful(); $event->stopPropagation(); } @@ -85,11 +85,11 @@ class EncoderSubscriber implements EventSubscriberInterface $event->addLine( sprintf( - '%s = L.Contao.loadLayer(%s, %s, %s, %s, map);', + '%s = L.contao.loadLayer(%s, %s, %s, %s, map);', $ref, $encoder->encodeValue($url), $encoder->encodeValue(strtolower(str_replace('Omnivore.', '', $value->getType()))), - $encoder->encodeValue($value->getOptions()), + $encoder->encodeArray($value->getOptions(), JSON_FORCE_OBJECT), $this->encodeCustomLayer($value, $encoder) ) );