You are here

file_mdm.module in File metadata manager 8

Same filename and directory in other branches
  1. 8.2 file_mdm.module

Provides a service to manage file metadata.

File

file_mdm.module
View source
<?php

/**
 * @file
 * Provides a service to manage file metadata.
 */
use Drupal\Core\Entity\EntityInterface;

/**
 * Implements hook_cache_flush().
 */
function file_mdm_cache_flush() {
  return [
    'file_mdm',
  ];
}

/**
 * Implements hook_file_delete().
 */
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());
}

Functions

Namesort descending Description
file_mdm_cache_flush Implements hook_cache_flush().
file_mdm_file_delete Implements hook_file_delete().