Mercurial > hg > isophonics-drupal-site
comparison core/modules/content_moderation/src/EntityOperations.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
233 * The entity revision being deleted. | 233 * The entity revision being deleted. |
234 * | 234 * |
235 * @see hook_entity_revision_delete() | 235 * @see hook_entity_revision_delete() |
236 */ | 236 */ |
237 public function entityRevisionDelete(EntityInterface $entity) { | 237 public function entityRevisionDelete(EntityInterface $entity) { |
238 /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ | 238 if ($content_moderation_state = ContentModerationStateEntity::loadFromModeratedEntity($entity)) { |
239 if (!$entity->isDefaultRevision()) { | 239 if ($content_moderation_state->isDefaultRevision()) { |
240 $content_moderation_state = ContentModerationStateEntity::loadFromModeratedEntity($entity); | 240 $content_moderation_state->delete(); |
241 if ($content_moderation_state) { | 241 } |
242 else { | |
242 $this->entityTypeManager | 243 $this->entityTypeManager |
243 ->getStorage('content_moderation_state') | 244 ->getStorage('content_moderation_state') |
244 ->deleteRevision($content_moderation_state->getRevisionId()); | 245 ->deleteRevision($content_moderation_state->getRevisionId()); |
245 } | 246 } |
246 } | 247 } |