diff --git a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php index d8654f6142..a8665020be 100644 --- a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php @@ -123,10 +123,15 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $workflow = $this->moderationInformation->getWorkflowForEntity($entity); $default = $workflow->getTypePlugin()->getInitialState($entity); - // Retrieve the correct current state value. + // If the entity is not new, grab the most recent revision and + // load it. The moderation state of the saved revision will be used + // to display the current state as well determine the the appropriate + // transitions. if (!$entity->isNew()) { $revision_id = $entity->getLoadedRevisionId(); $saved_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($revision_id); + + // If the entity allows translations, grab the translated version. if ($saved_entity->getEntityType()->isTranslatable() && $saved_entity->hasTranslation($entity->langcode->value)) { $saved_entity = $saved_entity->getTranslation($entity->langcode->value); $workflow = $this->moderationInformation->getWorkflowForEntity($saved_entity);