Skip to content

Commit

Permalink
VACMS-13214: Refactors draft and archived display
Browse files Browse the repository at this point in the history
  • Loading branch information
omahane committed Mar 5, 2024
1 parent 098e6b3 commit 44b8746
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,10 @@ public function alterAppendedSystemHealthServices(EntityViewAlterEvent $event):v
unset($build['field_clinical_health_services'][$key]);
$service_node = $services_copy[$key]['#options']['entity'];
$moderationState = $service_node->get('moderation_state')->value;
// Remove archived from temp array.
if ($moderationState === 'archived') {
unset($services_copy[$key]);
}
// If draft, show as such on view.
$thisRevisionIsPublished = $service_node->isPublished();
$defaultRevisionIsPublished = (isset($service_node->original) && ($service_node->original instanceof EntityInterface))
? (bool) $service_node->original->status->value
: (bool) $service_node->status->value;
if (!$defaultRevisionIsPublished && !$thisRevisionIsPublished) {
// Identify archive and draft in temp array.
if ($moderationState === 'archived' || $moderationState === 'draft') {
$services_copy[$key]['#attributes'] = ['class' => 'node--unpublished'];
$services_copy[$key]['#title'] .= ' (' . ucfirst($moderationState) . ')';
}
}
}
Expand Down

0 comments on commit 44b8746

Please sign in to comment.