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.

Comments

gun_dose created an issue. See original summary.

greenskunk’s picture

Status: Active » Reviewed & tested by the community

Good job @gun_dose!

greenskunk’s picture

Trying 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?

gun_dose’s picture

StatusFileSize
new2.12 KB

@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 :)

greenskunk’s picture

@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

itamair’s picture

Status: Reviewed & tested by the community » Fixed

last module release should have fixed this too

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.