diff core/modules/content_moderation/src/EntityOperations.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/core/modules/content_moderation/src/EntityOperations.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/modules/content_moderation/src/EntityOperations.php	Thu May 09 15:34:47 2019 +0100
@@ -235,10 +235,11 @@
    * @see hook_entity_revision_delete()
    */
   public function entityRevisionDelete(EntityInterface $entity) {
-    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
-    if (!$entity->isDefaultRevision()) {
-      $content_moderation_state = ContentModerationStateEntity::loadFromModeratedEntity($entity);
-      if ($content_moderation_state) {
+    if ($content_moderation_state = ContentModerationStateEntity::loadFromModeratedEntity($entity)) {
+      if ($content_moderation_state->isDefaultRevision()) {
+        $content_moderation_state->delete();
+      }
+      else {
         $this->entityTypeManager
           ->getStorage('content_moderation_state')
           ->deleteRevision($content_moderation_state->getRevisionId());