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.
The patch for #768294: Views Block still visible without values in OpenLayers view introduced a new issue. When the query is overridden, the results array is filled with a boolean instead of an array. The faulty line is:
$this->view->result = TRUE;
This leads to error messages if the results array is post-rendered or processed in any way after the query has been run. For instance: in the search_api_views module SearchApiViewsQuery:get_result_wrappers() gives an error because TRUE is passed to a foreach loop.
I believe the view result should be set to an empty array instead.
Comment | File | Size | Author |
---|---|---|---|
#7 | openlayers_2457303-7.patch | 819 bytes | basvredeling |
#4 | openlayers-2457303-2.patch | 1.02 KB | basvredeling |
openlayers-query-override-empty-results.patch | 780 bytes | basvredeling | |
Comments
Comment #1
basvredelingOh, this needs a review.
FYI, view.inc defines the result property as follows:
so setting it as true is not a good idea.
Comment #2
PolComment #4
basvredelingSorry Pol, while I was working on an updated patch you committed it.
This just needed some more work.
The code 2 lines down also injects a boolean or string into the result array. All to hide empty blocks.
I'm not 100% sure about this solution but it seems to work (also with views_geojson based maps).
Comment #5
PolIndeed, this patch is better.
Thanks !
Comment #7
basvredelingThis last patch was missing another small piece of code. $this->map was not set on the object.
Final fix here. This patch is made against latest dev. It doesn't include the commit of #4.
Comment #8
basvredelingPlease review urgently, currently applied patch breaks some maps.
Comment #9
Pol