Hello,
I was looking for a way to customize the text on the bottom of the map.
By doing some searches, I saw that the parameter 'attribution' in the layer definition is the variable to change.
After looking at the best and cleanest way to do it, I modified the includes/layer_types/xyz.inc file to include a new field in the options_form() method.
The problem I encountered by doing this is that, when you clone the OSM Mapnik map, the 'Base URL' is not set.
The correct parameter for the map is 'url' and not 'base_url'.
I've updated that file too to replace any references to base_url and it's now working pretty good.
I can now clone the OSM Mapnik layer and I can customize the attribution. The URL is set automatically when I clone the map, as it should be. It wasn't the case before.
My patch is against 6.x-2.x-dev and probably for the alpha10 too.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | set_url_parameter-1135274-2.patch | 2.45 KB | pol |
| #3 | set_url_parameter-1135274-1.patch | 2.42 KB | pol |
| #1 | set_url_parameter-1135274.patch | 1.25 KB | pol |
Comments
Comment #1
polHere is the patch.
Comment #2
zzolo commentedHi @Pol. Many thanks for the patch. The attribution field is a good addition. Unfortuantely, your change form base_url to url, though good for sticking to OpenLayers conventions, will break current sites that use this layer. Can you provide a patch that does a bit of backwards compatible code, possibly in the xyz.js that just checks for url first, then base_url? Many thanks.
Comment #3
polHello Zollo,
I don't think that changing the JS is a very good idea, I like to keep thing small and clean in JS.
I'm aware that adding a check for base_url and then url is not much but it adds some useless checks.
More than that, if I provide the patch with the update that will correct everything in the custom layers, those JS checks will be no more needed.
I did this patch, I hope it's ok. (I also used --relative --no-prefix to git diff.)
Comment #4
polOops, I updated the coding style to respect standard and remove tabs for spaces.
Comment #5
zzolo commented@Pol, that's awesome that you made an update function!
But :) there are still many people that have layers in code that can't be updated by an update function. This is the down side of the current Features (configuration management) paradigm in Drupal.
So, I still think we need that bit of backwards compatibility in the JS, even though, as I do agree, its really ugly and annoying. Maybe in the 3.x version we can remove this code.
Comment #6
polComment #7
ken-g commented