diff --git a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php index fca7e87..687a7c5 100644 --- a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php +++ b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php @@ -30,13 +30,13 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * {@inheritdoc} */ public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state) { - if ($this->shouldModerate($entity, $published_state)) { - // This is probably not necessary if configuration is setup correctly. - $entity->setNewRevision(TRUE); - $entity->isDefaultRevision($default_revision); + // This is probably not necessary if configuration is setup correctly. + $entity->setNewRevision(TRUE); + $entity->isDefaultRevision($default_revision); + if ($this->shouldModerate($entity, $published_state)) { if ($entity instanceof EntityPublishedInterface) { - $entity->{$published_state ? 'setPublished' : 'setUnpublished'}(); + $published_state ? $entity->setPublished() : $entity->setUnpublished(); } } }