hook_entity_revision_delete

hook_entity_revision_delete(Drupal\Core\Entity\EntityInterface $entity)

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

Entity CRUD, editing, and view hooks
Hooks used in various entity operations.
Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1239
Hooks and documentation related to entities.

Code

function hook_entity_revision_delete(Drupal\Core\Entity\EntityInterface $entity) {
  $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
  foreach ($referenced_files_by_field as $field => $uuids) {
    _editor_delete_file_usage($uuids, $entity, 1);
  }
}
doc_Drupal
2016-10-29 09:18:01
Comments
Leave a Comment

Please login to continue.