Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityOperations.php

function EntityOperations::entityRevisionDelete

Parameters

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

See also

hook_entity_revision_delete()

File

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

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\content_moderation

Code

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());
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal