Commit e9542e5d authored by larowlan's avatar larowlan

Issue #2894765 by bendev, Sam152, arunkumark, cedric_a:...

Issue #2894765 by bendev, Sam152, arunkumark, cedric_a: BlockContentModerationHandler::enforceRevisionsEntityFormAlter sets incorrect keys in form
parent eefc5fcc
...@@ -15,9 +15,9 @@ class BlockContentModerationHandler extends ModerationHandler { ...@@ -15,9 +15,9 @@ class BlockContentModerationHandler extends ModerationHandler {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id) { public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id) {
$form['revision_information']['revision']['#default_value'] = TRUE; $form['revision']['#default_value'] = TRUE;
$form['revision_information']['revision']['#disabled'] = TRUE; $form['revision']['#disabled'] = TRUE;
$form['revision_information']['revision']['#description'] = $this->t('Revisions must be required when moderation is enabled.'); $form['revision']['#description'] = $this->t('Revisions must be required when moderation is enabled.');
} }
/** /**
......
...@@ -125,6 +125,13 @@ public function testCustomBlockModeration() { ...@@ -125,6 +125,13 @@ public function testCustomBlockModeration() {
// default revision and therefore visible. // default revision and therefore visible.
$this->drupalGet(''); $this->drupalGet('');
$this->assertText($pending_revision_body); $this->assertText($pending_revision_body);
// Check that revision is checked by default when content moderation is
// enabled.
$this->drupalGet('/block/' . $block->id());
$this->assertSession()->checkboxChecked('revision');
$this->assertText('Revisions must be required when moderation is enabled.');
$this->assertSession()->fieldDisabled('revision');
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment