Skip to content

Commit

Permalink
PXBF-1858-no-archived-in-json-data: Do not use archived content in bu…
Browse files Browse the repository at this point in the history
…ilding JSON data
  • Loading branch information
gchi25 committed Oct 16, 2024
1 parent e28e671 commit 2d7a918
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions usagov_benefit_finder/src/Traits/BenefitFinderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Drupal\usagov_benefit_finder\Traits;

use Drupal\Core\Entity\EntityInterface;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;

/**
Expand Down Expand Up @@ -158,6 +159,15 @@ public function getLifeEventForm($nid, $mode) {
* The node revision entity.
*/
public function getNode($nid, $mode) {
$node = Node::load($nid);

if ($node->hasField('moderation_state')) {
$moderation_state = $node->get('moderation_state')->value;
if ($moderation_state == 'archived') {
return NULL;
}
}

if ($mode == "published") {
$query = $this->entityTypeManager->getStorage('node')
->getQuery()
Expand Down

0 comments on commit 2d7a918

Please sign in to comment.