function ImageHooks::filePredelete

Same name and namespace in other branches
  1. 11.x core/modules/image/src/Hook/ImageHooks.php \Drupal\image\Hook\ImageHooks::filePredelete()

Implements hook_ENTITY_TYPE_predelete() for file entities.

Attributes

#[Hook('file_predelete')]

File

core/modules/image/src/Hook/ImageHooks.php, line 157

Class

ImageHooks
Hook implementations for image.

Namespace

Drupal\image\Hook

Code

public function filePredelete(FileInterface $file) : void {
  $imageDerivativeUtilities = ($this->imageDerivativeUtilitiesClosure)();
  // Delete any image derivatives of this image.
  $imageDerivativeUtilities->pathFlush($file->getFileUri());
}

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