Is it possible to let the map icon-> icon url field to accept replacement patterns? So for instance one can put in the nodes image as a marker on the map.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | leaflet-image-url-token-1918170-14.patch | 1.62 KB | Pete B |
| #6 | Leaflet_-_Token_support_for_Icons.png | 46.63 KB | osopolar |
| #5 | screen.jpg | 55.98 KB | andreystrelkov |
| #2 | leaflet-image-url-token-1918170-2.patch | 2.29 KB | osopolar |
Comments
Comment #1
FAAREIA commentedI'm just looking for that feature.
It would be nice to use token replacement within the Icon URL at views. Then, for example, we can create a color taxonomy vocabulary, with a custom field in which there will be an url (the image url).
Image size X and Y could be another customs fields in the taxonomy....
just a great feature could be...
thanks for all.
Comment #2
osopolarAdding token support for icons - not only iconURL, so icons with different size could also be used.
I am not sure if the image URL needs to be validated by the function
leaflet_icon_validate()needs to be disabled too.This does not work for views, at least not with field based displays.
Comment #3
andreystrelkov commentedHello, I apply this patch, but REPLACEMENT PARTS in Leaflet Map Setting is absent :(
Comment #4
osopolar@andreystrelkov: It's not in the Leaflet Map Settings, its in the field formatter settings (in content-type and views). I.e.: http://example.com/admin/structure/types/manage/{content-type}/display >> click on the gears icon and you will see the settings. At the end of the form is a tiny link to show all tokens.
I am not sure, if a path with token will be always valid. Maybe the validation callback needs to be adjusted for token use. The validation should only used for path with out token, because the token value is not known on form validation.
Comment #5
andreystrelkov commentedHmmm :(
And there are any chances that the tokens (replacement parts) were converted to links here?
Comment #6
osopolarYou need to scroll down a bit more. You can also use tokens for the other icon settings like Icon Size etc.
Comment #7
andreystrelkov commentedamazingly :(... I have this missing link. Maybe I applied the patch in the wrong way. Can You give your already patched leaflet.formatters.inc file, and please tell me another version of the module you.
Comment #8
osopolarI use leaflet version 7.x-1.0-beta3
0. Download current (stable) version of leaflet.
1. Change Directory to the leaflet module (i.e. cd sites/all/modules/contrib/leaflet)
2. run:
patch --dry-run -p1 < path-to-the-patchfile/leaflet-image-url-token-1918170-2.patch3. if above command runs without errors run
patch -p1 < path-to-the-patchfile/leaflet-image-url-token-1918170-2.patch... if ther are errors pleas post here.4. clear all your caches (ie. druch cc all)
More information about applying patches you will find under https://drupal.org/patch/apply
I hope this helps. Let me know here, if this works for you.
Comment #9
andreystrelkov commentedThanks a lot for that answer! It turns out I'm stupid, I tried to find in the display settings, and it turns out they are in the settings of the field with coordinates.
But here's the rub, your line into tokens only appears when you select a format Leaflet, but I have with this formatter my map is not displayed, and displayed only when the format longitude and latitude, which has no links to the tokens.
Can I have something mixed up?
Comment #10
osopolarYes, this is for leaflet maps only.
Check the console log for 404 errors on our marker image and the source code, if the marker image is there as expected (it should be in a json sting, somewhere in a js drupal settings variable).
Comment #11
2phaPlease take a look at the patch I have added over at https://drupal.org/node/2089209
It adds advanced map settings and token support for the marker url (same as here), but also adds it to leaflet_views too.
Comment #12
gcbGreat idea, thanks. It appears to be showing up in lots of patches, I've added this for all configuration fields on views & view modes.
Comment #13
gcbhttps://drupal.org/node/2148175
Comment #14
Pete B commentedThanks for the work here! It's great. There is one problem though.
Tokens don't work on leaflet_views unless you use the formatted entity in the description. Otherwise $entity is not available and the tokens get replaced with nothing.
I have added an option so we can use tokens in views.
Comment #15
mrpeanut commentedFor what it's worth, the patch in #14 applied cleanly and works great for me.
Comment #16
peter van den heuvel commentedFor me patch #14 worked also.
Getting a little offset in the markers though.
Suspect a CSS-problem, but nothing that can be solved.Are there any plans for this patch getting it in the leaflet-module?EDIT: used offset-marker settings.
Comment #17
andreystrelkov commentedAlso #14 work, but only TOKEN, replacement pattern didn't... sadly
Comment #18
milos.kroulik commentedI can also confirm, that patch in #14 works. Can this be switched to RTBC?
Comment #19
joelstein commentedPatch #14 works for me, if I use a token. Thanks!
Comment #20
robertwb commentedI am looking at this and the related #11, and wondering if the existing "html DivIcon" capability already accounts for this? However, I can not find any example documentation for employing DivIcon. If anyone knows how to do a custm icon in a ReWritten field using DivIcon, please post it up here.
Comment #21
robertwb commentedDocs on DivIcon in Leaflet (not Drupal specific): http://www.coffeegnome.net/labels-in-leaflet/
Comment #22
rudetrue commentedThanks for the patch #14. I'm using it to have different marker icons for the same content type, and it's working well.
The way the DivIcon works in this module didn't cover my use case. Also, this method is more straightforward to configure, and was the first thing I tried.
Comment #23
cornelyus commentedI applied the patch on #14, and it all works fine except that it doesn't replace tokens refering to the node, like [node:nid]. I needed the value of a field inside the node to make it possible to show different images for the icon.
I have version 1.1.
Comment #24
vinmassaro commentedTested the patch in #14 with success.
Comment #25
sano commentedpatch #14 works for me as well. thanks.