diff --git a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php index 62e504e4c0..e793c338fa 100644 --- a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php +++ b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php @@ -33,6 +33,9 @@ public function onPresave(ContentEntityInterface $entity, $default_revision, $pu // This is probably not necessary if configuration is setup correctly. $entity->setNewRevision(TRUE); $entity->isDefaultRevision($default_revision); + if ($entity->hasField('revision_translation_affected')) { + $entity->set('revision_translation_affected', TRUE); + } // Update publishing status if it can be updated and if it needs updating. if (($entity instanceof EntityPublishedInterface) && $entity->isPublished() !== $published_state) { diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php index 986ef3a4e5..5e5a64bc7b 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php @@ -280,7 +280,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 save this Content.'); + $this->assertSession()->pageTextContains('Unable to save this Moderated content.'); // Publish the french forward revision (revision 4). $this->drupalGet('fr/' . $edit_path); @@ -320,7 +320,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 save this Content.'); + $this->assertSession()->pageTextContains('Unable to save this Moderated content.'); // We should be able to publish the english forward revision (revision 7) $this->drupalGet($edit_path); @@ -368,7 +368,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 save this Content.'); + $this->assertSession()->pageTextContains('Unable to save this Moderated content.'); // Create new moderated content (revision 1). $this->drupalPostForm('node/add/moderated_content', [ @@ -387,24 +387,25 @@ public function testContentTranslationNodeForm() { $this->assertTrue($this->xpath('//input[@value="Save and Archive (this translation)"]')); $this->drupalPostForm(NULL, [], t('Save and Create New Draft (this translation)')); - // Add another draft for the translation (revision 2). - $this->drupalGet($translate_path); + // Add another draft for the translation (revision 3). + $this->drupalGet('fr/' . $edit_path); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Archive (this translation)"]')); $this->drupalPostForm(NULL, [], t('Save and Create New Draft (this translation)')); // It should be possible to create a further draft. - $this->drupalGet($translate_path); + $this->drupalGet('fr/' . $edit_path); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Archive (this translation)"]')); - // Editing the original translation should also be possible. - $this->drupalGet($edit); - $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); - $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); - $this->assertTrue($this->xpath('//input[@value="Save and Archive (this translation)"]')); + // Editing the original translation should not be possible. + $this->drupalGet($edit_path); + $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->assertSession()->pageTextContains('Unable to save this Moderated content.'); } }