summaryrefslogtreecommitdiffstats
path: root/core/modules
diff options
context:
space:
mode:
authorAlex Pott2019-02-22 11:15:24 (GMT)
committerAlex Pott2019-02-22 11:15:33 (GMT)
commitb5e3c4415ad6e98532b2c9b479018d98a06d2b8c (patch)
treee832998c2bdc6082738069937222ed22fe9810d4 /core/modules
parent7a3b37ec5dcb7efc430faec6eff67c965616bab0 (diff)
Issue #2995200 by Sam152, sjancich: Defaults for publishing options do not save when workflow is enabledHEAD8.6.x
(cherry picked from commit d0a2440cff67f55c45075c3d19dda4bc0215093d)
Diffstat (limited to 'core/modules')
-rw-r--r--core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php2
-rw-r--r--core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php17
2 files changed, 18 insertions, 1 deletions
diff --git a/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php
index 87e1b22..f07e780 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 @@ class NodeModerationHandler extends ModerationHandler {
*/
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 e8d8ccd..a0a5fe0 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 @@ class ModerationStateNodeTypeTest extends ModerationStateTestBase {
$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]');
+ }
+
}