In drupal-project/web/modules/contrib/styled_google_map/src/Plugin/views/style/StyledGoogleMapStyle.php the $results is empty after upgrade from Drupal 9 to Drupal 10.
D9.2.9: styled_google_map (8.X-2.0) / geocoder (8.x-3.20)
D10.2.5: styled_google_map (8.x-2.3) / geocoder (8.X-4.23)
create a view, select "styled google map" as format, add geolocation field and select it as field that contains the geodata.
(raw output / WKT)
The content type exists of a address field and a geolocation.
Below pre_prender function is correctly populated with the results, but the $results within the render() function remains empty (StyledGoogleMapStyle.php)...
function styled_google_map_views_pre_render(Drupal\views\ViewExecutable $view) {
if ($view->id() == 'your_view_id') {
\Drupal::logger('styled_google_map')->notice('Pre-render results: @results', ['@results' => print_r($view->result, TRUE)]);
}
}
No js errors, no php errors.
why is the result empty?
This map has 0 points
Issue fork styled_google_map-3439676
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3439676-render-function-keeps
changes, plain diff MR !3
Comments
Comment #2
redeight commentedSo, I believe the issue is that StylePluginBase->render() doesn't take any parameters, but StyledGoogleMapsStyle->render is defined as
public function render($results = [])and nothing passes anything to that $results. Adding$results = $this->view->result;as the first line of StyledGoogleMapsStyle->render suddenly fixes the issue. Which makes sense. The render function has access to the result directly from itself, no reason to pass in another array entirely.Comment #3
redeight commentedIs there something else that was supposed to populate that call to render with the $results it was expecting? Did Drupal change something so it no longer does that?
Comment #6
a.dmitriiev commentedTo be honest, I am shocked myself. I have no idea how it was working before like that :) Thank you for reporting this.
Comment #7
a.dmitriiev commented