Problem/Motivation
Since 7.x-1.0-alpha5 release of Views GeoJSON it's advised to use feed displays instead of page for better performance.
There are a warning at display settings window "Using the GeoJSON display style on "Page" displays is deprecated, but will continue to work until the next release.
hook_leaflet_geojson_source_info() currently is hardcoded to look for page displays. Which won't work anymore for the next Views GeoJSON release.
Proposed resolution
Don't check the display type, instead use the views API function $view->display_handler->get_url().
If it exposes an url and has the style views_geojson we should be set to use the view.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
None.
Original report by @okolobaxa
Since 7.x-1.0-alpha5 release of Views GeoJSON advised to use feed displays instead of page for better performance.
There are a warning at display settings window "Using the GeoJSON display style on "Page" displays is deprecated, but will continue to work until the next release. Instead, the GeoJSON display style should be used with a "Feed" display."
But now hook_leaflet_geojson_source_info() of Leaflet GeoJSON module is searched only for page displays.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | leaflet_geojson-more-robust-views-detection-2367459-7.patch | 1.63 KB | das-peter |
Comments
Comment #1
okolobaxa commentedHere is small patch for this problem. Tested on 2.x branch, but i think works same on 1.x
Comment #2
das-peter commentedI think we should tackle the issue by a more robust solution.
How about checking if the view actually exposes an url by using the API function
$view->display_handler->get_url().If it exposes an url and has the style
views_geojsonwe should be all set to use the view.Further the code to detect if there's a bbox argument should be more defensive to avoid notices.
Comment #3
mpgeek commentedI would agree with @das-peter here. His concept is more generic. @okolobaxa maybe you could generalize your patch. If it doesn't make sense to generalize, please do explain.
Comment #4
das-peter commented@mpgeek Was the status change intentionally? If so, what needs work? Anything that should changed in the patch? If not (yet) - I guess this still just needs reviews. And everyone is welcome to point things out that need actual work :)
Comment #5
mpgeek commented@das-peter, your status is correct. Lets get this reviewed.
Comment #6
okolobaxa commentedThanks for you answers! I agree, patch by @das-peter in better solution, let's use it.
Comment #7
das-peter commentedJust figured out we should check for the old and new style plugin:
in_array($style_plugin, array('views_geojson_feed', 'views_geojson')).Patch updated.
Comment #9
dasjoThanks!
I had to reroll the patch one onto the current dev version, committed :)