Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] add tilesurl option for leaflet map #196

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Maps_Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,9 @@
// user does not provide one.
$GLOBALS['egMapsLeafletZoom'] = 14;

// String. The default tilesurl for the leaflet map. This value will only be used when the
// user does not provide one.
$GLOBALS['egMapsLeafletTilesurlDefault'] = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';


$GLOBALS['egMapsGlobalJSVars'] = [];
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"maps_googlemaps3": "Google Maps v3",
"maps_leaflet": "Leaflet",
"maps-leaflet-par-defzoom": "Allows setting the default zoom level of the map.",
"maps-leaflet-par-tilesurl": "Tiles source url for the leaflet map.",
"maps_openlayers": "OpenLayers",
"maps_click_to_activate": "Click to activate map",
"maps_centred_on": "Map centered on $1, $2.",
Expand Down
1 change: 1 addition & 0 deletions i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"maps_googlemaps3": "Lable for a result format on SMW's special page \"Ask\".\n\n{{optional}}",
"maps_leaflet": "This is a field label.\n\n{{optional}}",
"maps-leaflet-par-defzoom": "{{maps-par|leaflet|defzoom}}",
"maps-leaflet-par-tilesurl": "{{maps-par|leaflet|tilesurl}}",
"maps_openlayers": "Lable for a result format on SMW's special page \"Ask\".\n\n{{optional}}",
"maps_click_to_activate": "This is an informatory message.",
"maps_centred_on": "This is an informatory message.\n\nParameters:\n* $1 - latitude\n* $2 - longitude",
Expand Down
6 changes: 6 additions & 0 deletions includes/services/Leaflet/Maps_Leaflet.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public function addParameterInfo( array &$params ) {
'default' => $GLOBALS['egMapsResizableByDefault'],
'message' => 'maps-par-resizable'
];

$params['tilesurl'] = [
'type' => 'boolean',
'default' => $GLOBALS['egMapsLeafletTilesurlDefault'],
'message' => 'maps-leaflet-par-tilesurl'
];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/services/Leaflet/jquery.leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
this.map = map;

// add an OpenStreetMap tile layer
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
L.tileLayer(options.tilesurl, {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

Expand Down