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 6, 2024
1 parent c8db275 commit 4cba0e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.field--name-field-clinical-health-services a.node--unpublished {
padding: unset;
}
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 4cba0e2

Please sign in to comment.