function hook_entity_revision_delete

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_revision_delete()
  2. 10 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_revision_delete()
  3. 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_revision_delete()
  4. 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_revision_delete()

Respond to entity revision deletion.

This hook runs once the entity revision has been deleted from the storage.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object for the entity revision that has been deleted.

See also

hook_ENTITY_TYPE_revision_delete()

Related topics

6 functions implement hook_entity_revision_delete()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

ContentModerationHooks::entityRevisionDelete in core/modules/content_moderation/src/Hook/ContentModerationHooks.php
Implements hook_entity_revision_delete().
ContentModerationHooks::entityRevisionDelete in core/modules/content_moderation/src/Hook/ContentModerationHooks.php
Implements hook_entity_revision_delete().
EditorHooks::entityRevisionDelete in core/modules/editor/src/Hook/EditorHooks.php
Implements hook_entity_revision_delete().
EditorHooks::entityRevisionDelete in core/modules/editor/src/Hook/EditorHooks.php
Implements hook_entity_revision_delete().
EntityOperations::entityRevisionDelete in core/modules/workspaces/src/Hook/EntityOperations.php
Implements hook_entity_revision_delete().

... See full list

1 invocation of hook_entity_revision_delete()
ContentEntityStorageBase::deleteRevision in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Deletes a specific entity revision.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1511

Code

function hook_entity_revision_delete(\Drupal\Core\Entity\EntityInterface $entity) : void {
  \Drupal::messenger()->addStatus(t('Deleted revision @revision from @type entity type', [
    '@revision' => $entity->getRevisionId(),
    '@type' => $entity->getEntityType()
      ->getLabel(),
  ]));
}

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