From d2bd27c960a6be448c849d42cdfc5d2f2468364d Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 19 Jul 2018 14:23:44 +0200 Subject: [PATCH] added another null check to contextual menu --- src/Plugin/Block/ContextualMenu.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Plugin/Block/ContextualMenu.php b/src/Plugin/Block/ContextualMenu.php index e1fd009..97d5548 100644 --- a/src/Plugin/Block/ContextualMenu.php +++ b/src/Plugin/Block/ContextualMenu.php @@ -101,10 +101,13 @@ class ContextualMenu extends BlockBase { private function casePage() { $case = \Drupal::routeMatch()->getParameter('oc_case'); $actor_id = \Drupal::service('user.private_tempstore')->get('opencase')->get('actor_id'); - $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id); - if ($actor) { + if ($actor_id) { // there is not always one stored. $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id); - $caseListLink = $this->getCaseListLink($actor); + if ($actor) { // actor may have been deleted. + $caseListLink = $this->getCaseListLink($actor); + } else { + $caseListLink = $this->getCaseListLinkAll(); + } } else { $caseListLink = $this->getCaseListLinkAll(); }