Commit b6890803 authored by alexpott's avatar alexpott
Browse files

Issue #2942497 by scott_euser, timmillwood, malcomio, Berdir: Using content...

Issue #2942497 by scott_euser, timmillwood, malcomio, Berdir: Using content moderation block in preview mode causes EntityStorageException
parent 3840ad24
......@@ -269,6 +269,9 @@ public function entityView(array &$build, EntityInterface $entity, EntityViewDis
if (!$this->moderationInfo->isModeratedEntity($entity)) {
if (isset($entity->in_preview) && $entity->in_preview) {
// If the component is not defined for this display, we have nothing to do.
if (!$display->getComponent('content_moderation_control')) {
......@@ -4,6 +4,7 @@
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\workflows\Entity\Workflow;
use Drupal\Core\Url;
* Tests the moderation form, specifically on nodes.
......@@ -80,6 +81,21 @@ public function testModerationForm() {
$this->assertField('edit-new-state', 'The node view page has a moderation form.');
// Preview the draft.
$this->drupalPostForm($edit_path, [
'body[0][value]' => 'Second version of the content.',
'moderation_state[0][state]' => 'draft',
], t('Preview'));
// The preview view should not have a moderation form.
$preview_url = Url::fromRoute('entity.node.preview', [
'node_preview' => $node->uuid(),
'view_mode_id' => 'full',
$this->assertNoField('edit-new-state', 'The node preview page has no moderation form.');
// The latest version page should not show, because there is still no
// pending 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