function EntityOperations::entityDelete

Same name in other branches
  1. 8.9.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityDelete()
  2. 10 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityDelete()
  3. 11.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityDelete()

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being deleted.

See also

hook_entity_delete()

File

core/modules/content_moderation/src/EntityOperations.php, line 224

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\content_moderation

Code

public function entityDelete(EntityInterface $entity) {
    $content_moderation_state = ContentModerationStateEntity::loadFromModeratedEntity($entity);
    if ($content_moderation_state) {
        $content_moderation_state->delete();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.