diff --git a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php index 687a7c5..f76c573 100644 --- a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php +++ b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php @@ -35,9 +35,7 @@ public function onPresave(ContentEntityInterface $entity, $default_revision, $pu $entity->isDefaultRevision($default_revision); if ($this->shouldModerate($entity, $published_state)) { - if ($entity instanceof EntityPublishedInterface) { - $published_state ? $entity->setPublished() : $entity->setUnpublished(); - } + $published_state ? $entity->setPublished() : $entity->setUnpublished(); } } @@ -56,7 +54,7 @@ protected function shouldModerate(ContentEntityInterface $entity, $published_sta // @todo clarify the first condition, https://www.drupal.org/node/2834953. // First condition is needed so you can add a translation. // Second condition checks to see if the published status has changed. - return $entity->isDefaultTranslation() || (!($entity instanceof EntityPublishedInterface) || $entity->isPublished() !== $published_state); + return $entity->isDefaultTranslation() || (($entity instanceof EntityPublishedInterface) && $entity->isPublished() !== $published_state); } /**