From 870ed8b41596cc4742680a94491e44ed899ac09e Mon Sep 17 00:00:00 2001 From: Christian Burk Date: Tue, 5 Mar 2024 11:49:28 -0600 Subject: [PATCH] VACMS-13214: Refactors draft and archived display --- .../css/set_vamc_system_health_service.css | 3 +++ .../EventSubscriber/VAMCEntityEventSubscriber.php | 13 +++---------- 2 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 docroot/modules/custom/va_gov_vamc/css/set_vamc_system_health_service.css diff --git a/docroot/modules/custom/va_gov_vamc/css/set_vamc_system_health_service.css b/docroot/modules/custom/va_gov_vamc/css/set_vamc_system_health_service.css new file mode 100644 index 00000000000..83c9900f120 --- /dev/null +++ b/docroot/modules/custom/va_gov_vamc/css/set_vamc_system_health_service.css @@ -0,0 +1,3 @@ +.field--name-field-clinical-health-services a.node--unpublished { + padding: unset; + } \ No newline at end of file diff --git a/docroot/modules/custom/va_gov_vamc/src/EventSubscriber/VAMCEntityEventSubscriber.php b/docroot/modules/custom/va_gov_vamc/src/EventSubscriber/VAMCEntityEventSubscriber.php index f3e94040a1c..d1b51c31a9c 100644 --- a/docroot/modules/custom/va_gov_vamc/src/EventSubscriber/VAMCEntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_vamc/src/EventSubscriber/VAMCEntityEventSubscriber.php @@ -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) . ')'; } } }