Tell us what you are trying to do?
I want to build a map view using the page builder functionality of Toolset blocks, but I would like to be able to edit the view loop to include a custom shortcode like you can do with the legacy views plugin (this allows us to use OpenStreetMap instead of Google Maps) - is this possible?
In an ideal world I would just like to be able to select OpenStreetMap/Leaflet instead of Google Maps in the Toolset map block but this isn't possible yet - is there any update on this feature request? https://toolset.com/errata/toolset-maps-open-source-maps-feature/
Is there any documentation that you are following?
https://toolset.com/lesson-placement/lesson-placements-1622939-1620853/
Is there a similar example that we can see?
We have implemented the legacy views solution here - hidden link - we would like to do the same on a page built with Toolset Blocks
Thanks
Hello and thank you for contacting the Toolset support.
Currently, we can't use another API or projects for Toolset Maps, other than Google or Azure Maps.
I'll add your voice to the feature request, but we don't have an estimated time for when it will be released.
We really want to support at least one open-source project on this. And we're doing our best to get to that point.
Thanks Jamal, yes please do, this is a much needed feature and I would really appreciate it if this can expedited!
Just going back to the first part of my question, is there any way of building a map view page with Toolset blocks and then editing the view loop? (replacing wpv-map-render and wpv-map-marker with a custom shortcodes from Leaflet plugin)
Thanks again
When building a map view with blocks, we do not use the "wpv-map-render" and "wpv-map-marker" anymore.
Toolset Maps offer the Map block. The block allows adding markers, and a marker can be configured to pull location data from a view. Check this screenshot hidden link on this page, we have a Map block and a view block. The map block has a marker that is configured to pull location data from the view(called All Places), from the custom field "Location"
We still support the legacy views, and you can create your map view with it. Go to Toolset->Settings->General(tab)->Editing Experience and activate both editors(legacy and block). Then reload the page, and you will see the menu entry (Toolset->Views), which will allow you to create a view with the legacy editor, using shortcodes.
Thanks Jamal. Is it possible to combine a block based view (to design the loop output etc) and a legacy view for the map part on the same page?
And if so, is it possible to set a filter that would work for both views?
Thanks
I think we can. The legacy view should only have the map and the marker inside of its loop.
Then, both views need to be filtered by the same URL parameter.
Can you elaborate more on how you intend to filter the views? Using a search form or directly in the views' query filters?
Thanks Jamal - it would be similar to this - hidden link - if you use the search form to filter, the view output and map view marker output change accordingly. This is what I would like to replicate.
Incidentally, this would be on an archive page, I don't know if that makes any difference?
I have made some progress with this on a local testing site, I've built a basic view using blocks with a simple search field (post title and content), I've then created a separate legacy view with just the map and marker and the same search parameter. This seems to work with the basic testing I've done so far - using the search field to filter seems to change both the archive view built with blocks and the map legacy view - would this by the correct route? Will there be any performance issues having both views on the same archive page (there may be up to 200 or so posts/map markers)?
Thanks again
Of course, there will be a performance hit, because, each view will run its underlying query.
You can choose to use a hybrid approach. Build the view using the legacy editor, and inside of the loop put the marker and a content template for the post. You can then build this content template using Blocks.
But, using this approach, won't let you build the view's search/filter form using Blocks, because the form is built within the view.
Ah ok, that's a shame. Hopefully there will bean inbuilt solution using open source maps soon as that would make life much easier!
If I was to go about using the hybrid approach suggested, can you outline how to build a content template using blocks that is used in the legacy editor (where is it saved?)
thanks
Check this screenshot and notice the "Block Editor" button above the content template that is used for the view hidden link
Great, thanks for the swift reply. Would the design of the layout for the archive page (e.g. having the map on the right hand side etc) using this approach have to be done using HTML/CSS rather than blocks?
Thanks again
Yes, indeed. You can use the Twitter Bootstrap grid to put the map on the right side. Toolset allows you to load, either version 3 or 4 of bootstrap. Configure which version in Toolset->Settings.
These are the documentation parts about the Bootstrap grid system for each version:
- V3.4: hidden link
- V4.0: hidden link
Thanks, I would prefer not to load Bootstrap but I'll work along this basis with the hope that there will be an integrated open source map solution soon!