Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Adds support for:
* Views
* Select field for popup text
* Mark multiple layers as visible
* Marker image path fix
Comment | File | Size | Author |
---|---|---|---|
#38 | leaflet_1338326-38.follow-up.patch | 962 bytes | adamdicarlo |
#33 | leaflet-export.txt | 6.41 KB | dasjo |
#21 | leaflet-1338326-21-views.patch | 8.35 KB | pvhee |
#8 | leaflet-1338326-views.patch | 5.43 KB | dasjo |
#2 | leaflet-config-views-2.patch | 8.39 KB | dasjo |
Comments
Comment #1
cescosa CreditAttribution: cescosa commented+1
Comment #2
dasjorerolled the patch to current 7.x-1.x branch
here's a screenshot of this working
also attached a leaflet test feature module that includes a place content type and a leaflet_test views that uses the leaflet_views_plugin_style
Comment #3
rerooting CreditAttribution: rerooting commentedIm trying to get the #2 patch working, and I'm running into some issues.
I made the content type and view myself rather than using the feature module. What happens is mostly specific to the style options. The first time I saved the style option, for whatever reason, no datasource came up (I had however set things up with geofield at the time).
When I go back and try to manipulate the style options again, not only do I not get a datasource, but when I got around to hit update, views spews out a json string (i reckon something regarding the required field is conflicting with the views_ui AJAX I am guessing).
I would spend some time debugging this, however I was merely testing the capability of the module as we were working it into a scope of work that is very much due today! If you have any issues duplicating the issue, I can help later tonight likely. Also, FYI, I applied the patch against the latest 7.x-1.x git branch.
Comment #4
geografa CreditAttribution: geografa commentedI get the same json output after updating as well. This happened before the patch, however. Not sure how I fixed it but now it's back.
Comment #5
dasjohm, the procedure mentioned above worked for me so far
maybe you want to try if the feature works?
i don't think there should be any differences to the patch i posted, but you can also try the 7.x-1.x-views branch of my sandbox: http://drupal.org/sandbox/dasjo/1408378
Comment #6
levelos CreditAttribution: levelos commentedThis is great, thanks @dasjo. I think I'd prefer to see Views integration in a submodule, E.g., modules/leaflet_views. Any chance you'd be up for re-rolling this patch in that format? The patch also mixes in a few other issues, potentially very legit ones. Lets keep those separate and address them in their own tickets here in the queue.
FWIW, I did some cleanup this morning and plan on rolling an alpha1 release as we need a tag to use against some projects we're deploying.
Comment #7
dasjohaving views integration in a submodule sounds good, i will see if i can re-roll the patch those days...
Comment #8
dasjohere's the patch which adds views integration as an optional submodule.
Comment #9
dasjowe might also want to integrate with views_geojson
#1370448: Provide GeoJSON Layers from Views (integrating with views_geojson)
Comment #10
kvit CreditAttribution: kvit commentedWhen enabling Leaflet views module from #8 get this:
Warning: include_once(.../sites/all/modules/leaflet/leaflet_views.views.inc) [function.include-once]: failed to open stream: No such file or directory in _theme_process_registry() (line 549 of .../includes/theme.inc).
Warning: include_once() [function.include]: Failed opening '.../sites/all/modules/leaflet/leaflet_views.views.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in _theme_process_registry() (line 549 of .../includes/theme.inc).
The error disappears when reloading Modules list page and a view with leaflet map format works fine.
I think it's an essential feature for most users, so, I vote for including #8 to dev and posiibly making alpha 2 release with it ASAP.
Comment #11
dasjoi can reproduce the errors from #10 but i really don't know why this happens
the declaration in the leaflet_views.info file should be fine
files[] = leaflet_views.views.inc
Comment #12
pribeh CreditAttribution: pribeh commentedAdding the following related issue link here just in case anyone workin on views integration has any ideas about working with multiple layers:
http://drupal.org/node/1443206
Thanks to hse and dasjo for getting a head start on views integration.
Comment #13
laurencemercerJust wanted to say thanks for the Views efforts here! I've been testing mapping solutions for a current project and now have Leaflet and MapBox streets tiles working with Views and exposed filters (I'm using Addressfield, Geofield, and Geocoder to create the geo data).
During testing I ended up re-working the leaflet_views module a little bit, and thought I'd share what I found. Word of warning: I'm no Views expert - just a tinkerer ;)
I created an 'includes' folder, moved leaflet_views.views.inc into the 'includes' folder, and split leaflet_views_plugin_style, which was previously in leaflet_views.views.inc, out into its own file (also in the 'includes' folder). As I understand it, this is the preferable structure. So, I now have:
leaflet
-leaflet_views
--leaflet_views.info
--leaflet_views.module
--includes
---leaflet_views.views.inc
---leaflet_views_plugin_style_leaflet.inc
I also renamed all instances of 'leaflet_views_plugin_style' to 'leaflet_views_plugin_style_leaflet'. Views plugin naming seems a bit of a dark art, but I think this is the prefered naming convention.
Regarding the warning mentioned in #10, I got the same thing. It looks to be an issue with the path which is declared in leaflet_views_views_plugins(). Currently it's using:
but I changed that to
Also in leaflet_views_views_plugins(), I removed the
line. I don't think that's necessary (though I couldn't find documentation to confirm).
I then modified leaflet_views.info like so:
In leaflet_views.module I changed:
to
However, I'm sure I remember reading somewhere that Views will automatically look for a 'modulename.views.inc' file in a folder called 'includes', so I don't think that this line is actually strictly necessary.
Anyway, I hope that's helpful :)
Comment #14
luka.oman CreditAttribution: luka.oman commentedSorry for a trivial question but since there has not been any status report or timeline when this added support will be added to the module itself, I would like to ask you how to add this patch to the module, so even casual people could use it in views.
Thank you and regards;
Luka
Comment #15
pvhee CreditAttribution: pvhee commentedlevelos, I would be interested to help support this module; I am further refactoring the Views integration with the patch from #8 to have it work with Display Formatters as well (so you can use e.g. Display Suite to theme the balloons).
I'd be looking at contributing it into a clean patch, but if I can get commit access I'll help out with new features/maintenance.
Comment #16
pribeh CreditAttribution: pribeh commented+1 to add pvhee as a co-maintainer.
Comment #17
rerooting CreditAttribution: rerooting commented+1 on that as well, i would love to see views support for this module!
Comment #18
jpstrikesback CreditAttribution: jpstrikesback commented@pvhee, just wondering if you've made progress on the display formatters end of things?
Cheers!
Comment #19
pvhee CreditAttribution: pvhee commentedI'm planning to spend the day on Views + display formatters integration during the Barcelona Dev Days (http://groups.drupal.org/node/234168). All patches will go back to this queue.
Comment #20
jpstrikesback CreditAttribution: jpstrikesback commentedHeh heh, that was a quick response :) Look forward to it, cheers!
Comment #21
pvhee CreditAttribution: pvhee commentedAttached a reworked patch to provide Views integration for Leaflet as a submodule.
Contains some general cleanup (e.g. no warnings appear as mentioned in #10) and refactoring.
The new patch has support for node display modes (similar to what OpenLayers provides): you could use the teaser/full content modes of a node to fill out the popup, or could use Display Suite to style the content of the popups rather than working with Views fields.
Make sure also to apply #6 from #1621688: Geofield Formatter Error re: GeoPHP.
Thanks a lot to dasjo for organizing the mapping sprint at the Barcelona Drupal Developer Days
Comment #22
vcardoso CreditAttribution: vcardoso commentedTested on a sandbox site, and it works like a charm!
Just had to activate the "new" Leaflet module (was not obvious at start) and everything rolled on.
Comment #23
rerooting CreditAttribution: rerooting commentedI'll be testing it today as well, very exciting! I plan on using this for 3 projects this week. I'll make sure to report any bugs that come up.
Would be great to get this and http://drupal.org/node/1621688 #4/#6 committed as soon as possible, potentially rolled into a new full release? I'd love to help with that wherever I can, including testing other patches that are needed for the next full release.
Thanks a bunch to pvhee, dasjo and everyone else who was involved in the mapping sprint!
Comment #24
levelos CreditAttribution: levelos commented@pvhee, just added you as a maintainer on the module, congrats! Really glad to see all the energy around this and certainly don't want to stand in the way. I'm on vacation with my family this week so have very limited availability, so will review things as I can.
If we can tackle major initiatives in feature/issue branches to make review easier, that'd be great as well. Thanks gang and looking forward to seeing the improvements coming out of the sprint and beyond.
Comment #25
pvhee CreditAttribution: pvhee commented@levelos Thanks a lot, I'll be pushing over the code along the weekend, and we can review other outstanding issues as well.
After the Views integration is in, we should probably put out an alpha2 release?
Comment #26
pribeh CreditAttribution: pribeh commentedMy two cents: alpha2 release after http://drupal.org/node/1446418 is resolved.
Comment #27
pvhee CreditAttribution: pvhee commented@pribeh: I'd separate that out into a (possible) alpha3 release, so we can push Views integration faster.
I'll be taking the time to review the other parts of the issue queue as well, so we can combine all the good work that has been done and make subsequent alpha releases. Then, once that is all in an tested, we can make a beta/official release.
Comment #28
pribeh CreditAttribution: pribeh commented@pvhee, totally makes sense.
Comment #29
pvhee CreditAttribution: pvhee commented#21 is commited, and about to roll out an alpha2 release with an updated README.
I'll be using proper Git attribution for future patches, but the patch was done by multiple people, and it seems we cannot use git commit --author for this? http://drupal.org/node/1146430#comment-4773114
Comment #30
dasjogreat work!
yeah, it seems you can only specify a single author using git attribution and add the other names in the comment
Comment #31
sahaj CreditAttribution: sahaj commentedI'm not getting any map output in my view with the last dev version, while I had it working with the patch.
Am I missing something?
Comment #32
batigolixI'm also getting a blank page. The view seems not to render.
I fiddled a bit with the settings and it seems it is caused by the settings of the Leaflet Map format in views
If you leave the field Description Content empty then the view stays blank. If you assign a value then the view works.
So maybe the field Description Content should be required and have a default value ...
Comment #33
dasjoi encountered the same blank page issue.
when using "entire node" + teaser or full-node for description, the maps is blank as shown above.
see the attached views export.
when using "entire row" for description, the map will show up, but popups don't work + it shows
Comment #34
pvhee CreditAttribution: pvhee commentedI've confirmed the blank page, and the reason was that we do not render anything when description was not set, as mentioned by batigolix.
Committed code (http://drupalcode.org/project/leaflet.git/commit/16b213a) to address two things:
Please review the code, but it solved all the mentioned issues in my sandbox.
Comment #35
dasjousing "entire node" still doesn't work for me. i have added the views export in #33.
as a side-note, there are some spaces in empty lines in the code. there is a nice tool that allows checking code-style, also online: http://drupal.org/project/pareviewsh
Comment #36
adamdicarlo CreditAttribution: adamdicarlo commentedViews support is working for me. There's a huge pitfall, however, that took me a couple of hours to figure out:
In the view, don't use the Leaflet formatter on the Geofield. Doing so causes the field to be formatted (invoking leaflet_render_map()) which is bad news because it spits out JavaScript settings for a map you don't actually want to show (you don't want to show an individual map for each node), and latter calls to leaflet_render_map() don't change the JavaScript settings due to how drupal_add_js(_, 'setting'); works.
So if you get a blank map and a JavaScript error that says "Uncaught TypeError: Cannot read property '_leaflet' of null", there's your problem.
Comment #37
pvhee CreditAttribution: pvhee commented@dasjo: the 'entire node' is working for me with your View (and replacing the content type filter).
@adamdicarlo: good point, you indeed need to use the WKT / lat/lng formatters for the geofield, if not a Leaflet map is generated for each field which will conflict with the map created by the style. Not sure how to change that though, but we should probably remove the leaflet formatter view when the leaflet style is used.
Comment #38
adamdicarlo CreditAttribution: adamdicarlo commentedJust found a bug: Same content in each pop-up.
Every location I clicked was showing the same thing in the pop-up. After doing some digging I figured out why: the $raw_data array just keeps accumulating geofield values every time through the loop. Not good!
Here's the one-liner fix.
Comment #39
pvhee CreditAttribution: pvhee commentedThanks adamdicarlo, this is now committed.
Closing issue, please file separate issues for the views integration so we can track them better.