Problem/Motivation
I'm using a 'Leaflet map' formater for my Geofield field.
When using token in the iconsrc path (as gps-[node:nid]), the token is replaced by its value.
When using token in the icon class name (also as gps-[node:nid]), it's not.
Formater setting:

Icon html output :
<img src="https://mysite.ddev.site/themes/custom/mysitetheme/build/assets/icons/gps-21.svg" class="leaflet-marker-icon gps-[node:nid] leaflet-zoom-animated leaflet-interactive" style="margin-left: -15px; margin-top: -43px; width: 30px; height: 43px; transform: translate3d(558px, 200px, 0px); z-index: 200; outline-style: none;" alt="" tabindex="0" role="button">
| Comment | File | Size | Author |
|---|---|---|---|
| SCR-20251028-nywr.jpg | 125.89 KB | phily |
Issue fork leaflet-3554815
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3554815-token-in-icon
changes, plain diff MR !65
Comments
Comment #2
philyProposed resolution
In src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php file @line 462
should be written
Comment #4
itamair commentedComment #7
santanu mondal commentedComment #8
itamair commentedThanks @phily ... nice catch.
Latest commit from mine (that slightly extended your MR): https://git.drupalcode.org/project/leaflet/-/commit/f1843cd010d81b8eddf0...
and new 10.3.11 Leaflet module release fix all this.
Regards.