diff --git a/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php index 87e1b22c8d9cb468396c29ccf13948f8031d2603..f07e7804b4a6a0e5dff1149982a91db569d83537 100644 --- a/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php +++ b/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php @@ -54,7 +54,7 @@ public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface */ public function enforceRevisionsBundleFormAlter(array &$form, FormStateInterface $form_state, $form_id) { // Force the revision checkbox on. - $form['workflow']['options']['#value']['revision'] = 'revision'; + $form['workflow']['options']['revision']['#value'] = 'revision'; $form['workflow']['options']['revision']['#disabled'] = TRUE; } diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php index e8d8ccd8df0606eba698e3a3ad1742b3d47424e3..a0a5fe01f8d53e67653b200c43b06de631f733be 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php @@ -88,4 +88,21 @@ public function testEnablingOnExistingContent() { $this->assertSession()->optionExists('moderation_state[0][state]', 'published'); } + /** + * @covers \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter + */ + public function testEnforceRevisionsEntityFormAlter() { + $this->drupalLogin($this->adminUser); + $this->createContentTypeFromUi('Moderated', 'moderated'); + + // Ensure checkboxes in the 'workflow' section can be altered, even when + // 'revision' is enforced and disabled. + $this->drupalGet('admin/structure/types/manage/moderated'); + $this->drupalPostForm('admin/structure/types/manage/moderated', [ + 'options[promote]' => TRUE, + ], 'Save content type'); + $this->drupalGet('admin/structure/types/manage/moderated'); + $this->assertSession()->checkboxChecked('options[promote]'); + } + }