diff --git a/assets/libs/contao/contao-leaflet.js b/assets/libs/contao/contao-leaflet.js index d271d23..b47fe81 100644 --- a/assets/libs/contao/contao-leaflet.js +++ b/assets/libs/contao/contao-leaflet.js @@ -1,6 +1,7 @@ L.Contao = L.Class.extend( { includes: L.Mixin.Events, + attribution: ' | netzmacht creative', /** * The map registry. */ @@ -38,6 +39,8 @@ L.Contao = L.Class.extend( { * @returns {L.Contao} */ addMap: function (id, map) { + map.map.attributionControl.setPrefix(map.map.attributionControl.options.prefix + this.attribution); + this.maps[id] = map; this.fire('map:added', { id: id, map: map}); diff --git a/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php b/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php index 22544cb..3d2d2b6 100644 --- a/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php +++ b/src/Netzmacht/Contao/Leaflet/Subscriber/EncoderSubscriber.php @@ -30,32 +30,11 @@ class EncoderSubscriber implements EventSubscriberInterface return array( BuildEvent::NAME => array( array('startWrapper', 1000), - array('addAttribution'), array('endWrapper', -1000) ) ); } - /** - * Add contao-leaflet attribution. - * - * @param BuildEvent $event - */ - public function addAttribution(BuildEvent $event) - { - $object = $event->getObject(); - - if ($object instanceof Map) { - $attribution = <<Leaflet | ' + - 'netzmacht creative' -); -HTML; - $event->getOutput()->addLine($attribution); - } - } - /** * Start the wrapper. *