Skip to content
Snippets Groups Projects
Unverified Commit d0a2440c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2995200 by Sam152, sjancich: Defaults for publishing options do not...

Issue #2995200 by Sam152, sjancich: Defaults for publishing options do not save when workflow is enabled
parent 185513fe
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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]');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment