You are here

function file_mdm_file_delete in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 file_mdm.module \file_mdm_file_delete()

Implements hook_file_delete().

File

./file_mdm.module, line 20
Provides a service to manage file metadata.

Code

function file_mdm_file_delete(EntityInterface $entity) {

  // Deletes any cached file metadata information upon deletion of a file
  // entity.
  $fmdm = \Drupal::service('file_metadata_manager');
  $fmdm
    ->deleteCachedMetadata($entity
    ->getFileUri());
  $fmdm
    ->release($entity
    ->getFileUri());
}