diff --git a/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php b/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php index 637c03c84..6651db665 100644 --- a/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php +++ b/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php @@ -226,9 +226,11 @@ public function getData($id) { if (empty($life_event_form_node)) { $result = []; $json = json_encode($result, JSON_PRETTY_PRINT); - print_r("

JSON Data

");
-      print_r($json);
-      print_r("
"); + if ($this->displayData) { + print_r("

JSON Data

");
+        print_r($json);
+        print_r("
"); + } return $result; } diff --git a/usagov_benefit_finder/src/Traits/BenefitFinderTrait.php b/usagov_benefit_finder/src/Traits/BenefitFinderTrait.php index c7c66b942..b509b47e2 100644 --- a/usagov_benefit_finder/src/Traits/BenefitFinderTrait.php +++ b/usagov_benefit_finder/src/Traits/BenefitFinderTrait.php @@ -161,6 +161,10 @@ public function getLifeEventForm($nid, $mode) { public function getNode($nid, $mode) { $node = Node::load($nid); + if (!$node) { + return NULL; + } + if ($node->hasField('moderation_state')) { $moderation_state = $node->get('moderation_state')->value; if ($moderation_state == 'archived') {