From c50b3d34a54d8f039530bd47451c9f530e985e44 Mon Sep 17 00:00:00 2001 From: Erik Stielstra <40452-sutharsan@users.noreply.drupalcode.org> Date: Mon, 30 Jan 2023 11:31:10 +0100 Subject: [PATCH] Issue #3281927 by Sutharsan, nsciacca: Error on node revision route due to core type upcasting change --- src/Plugin/Block/FieldBlock.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Plugin/Block/FieldBlock.php b/src/Plugin/Block/FieldBlock.php index 2dc06d0..3897972 100644 --- a/src/Plugin/Block/FieldBlock.php +++ b/src/Plugin/Block/FieldBlock.php @@ -458,7 +458,12 @@ class FieldBlock extends BlockBase implements ContainerFactoryPluginInterface { elseif ($entity_type === 'node') { if ($route_name == 'entity.node.revision') { $entity_revision = $this->routeMatch->getParameter('node_revision'); - $entity = $this->entityTypeManager->getStorage('node')->loadRevision($entity_revision); + if (is_numeric($entity_revision)) { + $entity = $this->entityTypeManager->getStorage('node')->loadRevision($entity_revision); + } + else { + $entity = $entity_revision; + } } elseif ($route_name == 'entity.node.preview' && $this->routeMatch->getParameter('view_mode_id') === 'full') { $entity = $this->routeMatch->getParameter('node_preview'); -- GitLab