diff --git a/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanAttachmentMap.php b/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanAttachmentMap.php
index 2000a7132..f7a87748d 100644
--- a/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanAttachmentMap.php
+++ b/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanAttachmentMap.php
@@ -6,6 +6,7 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Markup;
+use Drupal\ghi_base_objects\Entity\BaseObjectAwareEntityInterface;
use Drupal\ghi_blocks\Interfaces\ConfigValidationInterface;
use Drupal\ghi_blocks\Interfaces\MultiStepFormBlockInterface;
use Drupal\ghi_blocks\Interfaces\OverrideDefaultTitleBlockInterface;
@@ -1201,11 +1202,12 @@ private function getAttachmentSwitcher() {
* An array with context data or query handlers.
*/
public function getBlockContext() {
+ $page_node = $this->getPageNode();
return [
- 'page_node' => $this->getPageNode(),
+ 'page_node' => $page_node,
'plan_object' => $this->getCurrentPlanObject(),
- 'base_object' => $this->getCurrentBaseObject(),
- 'context_node' => $this->getPageNode(),
+ 'base_object' => $this->getCurrentBaseObject($page_node instanceof BaseObjectAwareEntityInterface ? $page_node : NULL),
+ 'context_node' => $page_node,
'attachment_prototype' => $this->getAttachmentPrototype(),
];
}
diff --git a/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanEntityLogframe.php b/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanEntityLogframe.php
index 38053ca45..14c5be82d 100644
--- a/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanEntityLogframe.php
+++ b/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanEntityLogframe.php
@@ -7,6 +7,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Markup;
use Drupal\Core\Security\TrustedCallbackInterface;
+use Drupal\ghi_base_objects\Entity\BaseObjectAwareEntityInterface;
use Drupal\ghi_blocks\Interfaces\ConfigValidationInterface;
use Drupal\ghi_blocks\Interfaces\ConfigurableTableBlockInterface;
use Drupal\ghi_blocks\Interfaces\CustomLinkBlockInterface;
@@ -612,7 +613,8 @@ private function getEntityRefCodeOptions() {
* An array of plan entity objects for the current context.
*/
private function getPlanEntities($entity_ref_code = NULL) {
- $context_object = $this->getCurrentBaseObject();
+ $page_node = $this->getPageNode();
+ $context_object = $this->getCurrentBaseObject($page_node instanceof BaseObjectAwareEntityInterface ? $page_node : NULL);
if ($entity_ref_code == 'PL' && $context_object instanceof Plan) {
/** @var \Drupal\ghi_plans\Plugin\EndpointQuery\EntityQuery $query */
@@ -730,12 +732,13 @@ public function getBlockContext() {
// This can be any parent node, e.g. SectionNode or PlanClusterNode.
$base_entity = $this->getCurrentBaseEntity();
$section_node = $this->sectionManager->getCurrentSection($base_entity);
+ $page_node = $this->getPageNode();
return [
'section_node' => $section_node,
- 'page_node' => $this->getPageNode(),
+ 'page_node' => $page_node,
'plan_object' => $plan_object,
- 'base_object' => $this->getCurrentBaseObject(),
- 'context_node' => $this->getPageNode(),
+ 'base_object' => $this->getCurrentBaseObject($page_node instanceof BaseObjectAwareEntityInterface ? $page_node : NULL),
+ 'context_node' => $page_node,
'entities' => $plan_entities,
'entity_types' => $this->logframeManager->getEntityTypesFromPlanObject($plan_object),
'attachment_prototypes' => $this->getAttachmentPrototypes(),
diff --git a/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanHeadlineFigures.php b/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanHeadlineFigures.php
index d1129b222..82b176868 100644
--- a/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanHeadlineFigures.php
+++ b/html/modules/custom/ghi_blocks/src/Plugin/Block/Plan/PlanHeadlineFigures.php
@@ -4,6 +4,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Drupal\ghi_base_objects\Entity\BaseObjectAwareEntityInterface;
use Drupal\ghi_blocks\Interfaces\ConfigValidationInterface;
use Drupal\ghi_blocks\Interfaces\ConfigurableTableBlockInterface;
use Drupal\ghi_blocks\Interfaces\MultiStepFormBlockInterface;
@@ -219,7 +220,7 @@ public function getBlockContext() {
'section_node' => $this->getCurrentBaseEntity(),
'page_node' => $page_node,
'plan_object' => $this->getCurrentPlanObject(),
- 'base_object' => $this->getCurrentBaseObject(),
+ 'base_object' => $this->getCurrentBaseObject($page_node instanceof BaseObjectAwareEntityInterface ? $page_node : NULL),
'context_node' => $page_node,
];
}