Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
At some point the module was refactored to consolidate field formatters. This broke the views support for HTML markers.
The following error is a symptom of this:
Notice: Undefined index: entity in function leaflet_apply_map_settings() (line 394 in...
Comment | File | Size | Author |
---|---|---|---|
#12 | leaflet-views-html-markers-2327711-12.patch | 3.66 KB | das-peter |
#12 | interdiff-2327711-11-12-do-not-test.diff | 1.45 KB | das-peter |
Comments
Comment #1
milesw CreditAttribution: milesw commentedHere is a small patch to fix Views support.
Comment #2
milesw CreditAttribution: milesw commentedComment #3
Alex Bukach CreditAttribution: Alex Bukach commentedmilesw, it seems the path is not against the latest dev version. Here's correct one.
Comment #4
Alex Bukach CreditAttribution: Alex Bukach commentedComment #5
Alex Bukach CreditAttribution: Alex Bukach commentedComment #6
kufeiko CreditAttribution: kufeiko commentedWorks fine for me, against current 7.x-1.x-dev.
Comment #7
milesw CreditAttribution: milesw commentedNot sure what happened with the original patch. Here's a new one.
Tried #3 but it looks like it was created from Drupal root and won't apply for me.
Comment #8
milesw CreditAttribution: milesw commentedLooks like my last two patches were bad because I had ignored whitespace changes.
This patch should apply without issues.
Comment #9
Alex Bukach CreditAttribution: Alex Bukach commentedThanks for fixing patch path in #8, milesw. Works fine as well.
Comment #10
Alex Bukach CreditAttribution: Alex Bukach commentedIt appears the we should set iconSize for views as well, otherwise leaflet sets default icon size.
Comment #11
das-peter CreditAttribution: das-peter commentedI've still trouble with the patches posted here.
Here's a manual re-roll - no clue if the functionality is as intended.
However I start to test the functionality now.
Comment #12
das-peter CreditAttribution: das-peter commentedJust stumbled over notices triggered by the current patch.
The icon size handling should work for html and marker - but currently it deals with a variable that's just available if a marker is configured.
Added condition.
Comment #13
texas-bronius CreditAttribution: texas-bronius commenteddas-peter's patch applied OK and provides html output as a leaflet point marker for me. Click event still works to boot :)
I read above about "latest dev" of d.o leaflet module, but that one threw an error for me here:
http://cgit.drupalcode.org/leaflet/commit/?id=d3843bd
Instead, I reverted just the line at the bottom:
and that allowed the plugin as well as the html point style to work.
Comment #14
robertwb CreditAttribution: robertwb commentedFolks - I would love to review this and add my support to a RTBC status, but I lack the knowledge of how to use the *@%$#!! DivIcon functionaltiy! If someone on this thread could be so kind as to show some views field config that makes this work, it would not only help me heaps (cause I need this), but as mentioned I will add my $0.02 to the review.
Thanks!
Comment #15
milesw CreditAttribution: milesw commented@robertwb The option for Views can be found in the Leaflet Map style settings.
1. Make sure "Leaflet Map" is chosen in the Format section of the Views UI.
2. Open the Settings link from the Format section.
3. Open the fieldset named "Point Icon".
4. For "Icon Source" choose "Field (html DivIcon)"
5. For "Marker field" choose the Views field you want to output as your markers.
Comment #16
robertwb CreditAttribution: robertwb commented@milesw - I should have been more clear. I get all of that, it's the actual field HTML that I don't get -- my CSS sucks if that helps you see where I'm coming
Comment #17
milesw CreditAttribution: milesw commented@robertwb If you're not writing the CSS, you probably don't need this feature. It's meant to give you control over the markup and therefore the style. The field HTML is whatever gets rendered for the Views field you select. You can customize that to be anything you want with Views field rewriting.
Comment #18
robertwb CreditAttribution: robertwb commented@milesw - of course I need this feature, that's why I'm here... but my inexperience with CSS is causing me to fail to check this out. I also understand the field HTML gets rendered, but to construct field HTML that creates a usable custom icon escapes me.
Comment #19
robertwb CreditAttribution: robertwb commentedI was able to get going on this -- thanks to those who offered guidance. This patch works as advertised. I also added a related issue, which I created to provide documentation on some use cases for this feature at https://www.drupal.org/node/2390627
Comment #20
bisonbleu CreditAttribution: bisonbleu commentedIn reference to @milesw step-by-step in #15.
If you are wondering what to use for a basic Marker field, do the following.
In Fields, add a Global: custom text field and set its Text to
. You can leave the other settings to default in the Format | Settings UI. When you're done, Leaflet's default blue marker icons will be replaced by small white squares.You can see this and more sophisticated options by visiting the page created by @robertwb here.
Comment #21
tisteegz CreditAttribution: tisteegz commentedPatch in #12 worked for me.
Comment #22
FMB CreditAttribution: FMB commentedWorking for me too.
Comment #23
apetro CreditAttribution: apetro commentedPatch #12 works in my Drupal setup, too. When in Leaflet module?
Comment #24
robertwb CreditAttribution: robertwb commentedMarking this RTBC - patch applies against the most recent dev version (albeit with an offset).
Comment #26
RdeBoerPatch applied (manually as I've applied so many patches in the last couple of days, the code has changed -- please test 7.x-1.x-dev before we make it an official release!).
Rik
Comment #27
robertwb CreditAttribution: robertwb commentedI will begin testing tomorrow - thanks @RdeBoer!
Comment #28
robertwb CreditAttribution: robertwb commentedThe latest dev version provides this functionality cleanly. Verified over the course of several days now and just moved into production systems. I move to mark this closed.
Comment #29
RdeBoerGreat!
Thanks for confirming Robert.
Looks like we're almost read to make the current 7.x-1.x-dev the next official release.
I'll give it a little longer because so many patches have been applied recently.
Rik
Comment #30
robertwb CreditAttribution: robertwb commentedSounds good @RdeBoer - I guess it's pretty hard to develop automated testing for mapping/visualization stuff? Talk about an industry need...
Comment #31
robertwb CreditAttribution: robertwb commented