Skip to content

Commit

Permalink
PXBF-1846-needs-review-no-json-file: Do not generate JSON files when …
Browse files Browse the repository at this point in the history
…changing to needs review
  • Loading branch information
gchi25 committed Oct 4, 2024
1 parent bab009f commit 465d940
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@ use Drupal\usagov_benefit_finder_api\Controller\LifeEventController;
* @param Node $node
*/
function usagov_benefit_finder_api_node_update(Node $node) {
$generate_json_files = 1;
$url = _usagov_benefit_finder_api_get_current_page_url();

if (strpos($url, "/admin/content") === FALSE) {
if ($node->hasField('moderation_state')) {
$moderation_state = $node->get('moderation_state')->value;
if ($moderation_state == 'needs_review') {
$generate_json_files = 0;
}
}
}
else {
$generate_json_files = 0;
}

if ($generate_json_files == 1) {
_usagov_benefit_finder_api_batch_generate_json_data_files($node);
}
else {
Expand Down

0 comments on commit 465d940

Please sign in to comment.