diff --git a/core/modules/content_moderation/src/EntityTypeInfo.php b/core/modules/content_moderation/src/EntityTypeInfo.php index d673e13da4..362dcddce4 100644 --- a/core/modules/content_moderation/src/EntityTypeInfo.php +++ b/core/modules/content_moderation/src/EntityTypeInfo.php @@ -364,7 +364,7 @@ public function formAlter(array &$form, FormStateInterface $form_state, $form_id $this->entityTypeManager->getHandler($type->getBundleOf(), 'moderation')->enforceRevisionsBundleFormAlter($form, $form_state, $form_id); } } - elseif ($form_object instanceof ContentEntityFormInterface && $form_object->getOperation() == 'edit') { + elseif ($form_object instanceof ContentEntityFormInterface && in_array($form_object->getOperation(), ['edit', 'default'])) { $entity = $form_object->getEntity(); if ($this->moderationInfo->isModeratedEntity($entity)) { $this->entityTypeManager diff --git a/core/modules/content_moderation/src/StateTransitionValidation.php b/core/modules/content_moderation/src/StateTransitionValidation.php index f2f5df368a..c1e278aed0 100644 --- a/core/modules/content_moderation/src/StateTransitionValidation.php +++ b/core/modules/content_moderation/src/StateTransitionValidation.php @@ -44,6 +44,10 @@ public function getValidTransitions(ContentEntityInterface $entity, AccountInter // want to only allow specific transitions. if (count($entity->getTranslationLanguages()) > 1 && $this->moderationInfo->hasForwardRevision($entity)) { $permitted_transitions = array_filter($permitted_transitions, function(Transition $transition) use ($entity) { + if (!$this->moderationInfo->isLatestRevision($entity) && $entity->isNewTranslation()) { + return FALSE; + } + // The entity needs to be the latest and translation affected, or be // going from and to the same default revision state, or be going from // and to the same publishing state. diff --git a/core/modules/content_moderation/src/Tests/ModerationFormTest.php b/core/modules/content_moderation/src/Tests/ModerationFormTest.php index 6a5b3a3ddc..a2845a2316 100644 --- a/core/modules/content_moderation/src/Tests/ModerationFormTest.php +++ b/core/modules/content_moderation/src/Tests/ModerationFormTest.php @@ -271,7 +271,7 @@ public function testContentTranslationNodeForm() { $this->assertFalse($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Archive (this translation)"]')); - $this->assertText('It is not possible to Create New Draft, Publish, Archive this Content.'); + $this->assertText('It is not possible to Create New Draft, Publish this Content.'); } }