function hook_ENTITY_TYPE_revision_delete

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

Respond to entity revision deletion of a particular type.

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_revision_delete()

Related topics

File

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

Code

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

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