You are here

function entity_usage_entity_predelete in Entity Usage 8.3

Same name and namespace in other branches
  1. 8 entity_usage.module \entity_usage_entity_predelete()
  2. 8.2 entity_usage.module \entity_usage_entity_predelete()

Implements hook_entity_predelete().

File

./entity_usage.module, line 56
Contains entity_usage.module.

Code

function entity_usage_entity_predelete(EntityInterface $entity) {
  if (EntityUsageSourceLevel::isTopLevel($entity)) {
    \Drupal::service('entity_usage.entity_update_manager')
      ->addTopLevelSource($entity, EntityUpdateManager::OPERATION_ENTITY_DELETE);
  }
}