function EntityOperations::entityRevisionDelete
Same name in other branches
- 9 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()
- 8.9.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()
- 11.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity revision being deleted.
See also
File
-
core/
modules/ content_moderation/ src/ EntityOperations.php, line 237
Class
- EntityOperations
- Defines a class for reacting to entity events.
Namespace
Drupal\content_moderationCode
public function entityRevisionDelete(EntityInterface $entity) {
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());
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.