Hi! There were two issues about this in the past:
https://www.drupal.org/project/leaflet/issues/2903134
https://www.drupal.org/project/leaflet/issues/2732267
And there are two patches. If you look at them, you will notice that both of them reverts changes of each other at the same line:
var icon = new L.Icon({iconUrl: options.icon_url});
The problem is that with one patch views works well, but field formatter is broken, and with other patch everything happens vice versa.
So if you need use views and field formatter at the same project, you need 'iconUrl' and 'icon_url' at the same time. So I propose some easy solution of this problem:
var icon = new L.Icon({iconUrl: typeof options.iconUrl !== 'undefined' ? options.iconUrl : options.icon_url});
And here is patch for this.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | leaflet-icon-options-formatter.patch | 2.12 KB | gun_dose |
| leaflet-iconurl.patch | 434 bytes | gun_dose |
Comments
Comment #2
greenskunkGood job @gun_dose!
Comment #3
greenskunkTrying to see where this stems from as per the LeafletJS documentation it should be iconUrl.
The other variables also have an underscore in them and are incorrect in the drupalSettings.
Should I make a separate issue or attack the cause here?
Comment #4
gun_dose commented@GreenSkunk, other options are also broken - marker anchor options does not affect to anything. But I created patch also for this case. I don't sure if it must be a separate issue, or it is part of this issue, so I attached it to this comment. May be I should merge these two patches to one, I had no time to think about it :)
Comment #5
greenskunk@gun_dose I like your patch as it'll work either way.
Would you review the patch for the cause of the issue at https://www.drupal.org/project/leaflet/issues/2924430
Comment #6
itamair commentedlast module release should have fixed this too