From e6d488ac0555178f8950b623f3fb53737c75f276 Mon Sep 17 00:00:00 2001 From: itamair <itamair@me.com> Date: Thu, 17 Apr 2025 10:28:07 +0200 Subject: [PATCH] Issue #3512082: 10.2.30 not compatible with Drupal ^9.3 because of renderPlain deprecated in favour of renderInIsolation --- .../leaflet_views/src/Plugin/views/row/LeafletMarker.php | 9 ++++++++- .../leaflet_views/src/Plugin/views/style/LeafletMap.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/leaflet_views/src/Plugin/views/row/LeafletMarker.php b/modules/leaflet_views/src/Plugin/views/row/LeafletMarker.php index 88918ad..bc260ba 100644 --- a/modules/leaflet_views/src/Plugin/views/row/LeafletMarker.php +++ b/modules/leaflet_views/src/Plugin/views/row/LeafletMarker.php @@ -346,7 +346,14 @@ class LeafletMarker extends RowPluginBase implements ContainerFactoryPluginInter if ($this->options['description_field'] === '#rendered_entity' && is_object($row->_entity)) { $entity = $row->_entity; $build = $this->getEntityManager()->getViewBuilder($entity->getEntityTypeId())->view($entity, $this->options['view_mode']); - $popup_body = $this->renderer->renderInIsolation($build); + // Render popup body, + // ensuring backward compatibility (with Drupal < 10.2). + if (method_exists($this->renderer, 'renderInIsolation')) { + $popup_body = $this->renderer->renderInIsolation($build); + } + else { + $popup_body = $this->renderer->renderPlain($build); + } } // Normal rendering via fields. elseif ($this->options['description_field']) { diff --git a/modules/leaflet_views/src/Plugin/views/style/LeafletMap.php b/modules/leaflet_views/src/Plugin/views/style/LeafletMap.php index 89ecb39..71b4f40 100644 --- a/modules/leaflet_views/src/Plugin/views/style/LeafletMap.php +++ b/modules/leaflet_views/src/Plugin/views/style/LeafletMap.php @@ -1264,7 +1264,14 @@ class LeafletMap extends StylePluginBase implements ContainerFactoryPluginInterf $render_row = [ "markup" => $this->view->rowPlugin->render($result), ]; - $popup_content = $this->renderer->renderInIsolation($render_row); + // Render popup content, ensuring backward compatibility + // (with Drupal < 10.2). + if (method_exists($this->renderer, 'renderInIsolation')) { + $popup_content = $this->renderer->renderInIsolation($render_row); + } + else { + $popup_content = $this->renderer->renderPlain($render_row); + } break; default: -- GitLab