function ImageHooks::fileMove

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

Implements hook_file_move().

Attributes

#[Hook('file_move')]

File

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

Class

ImageHooks
Hook implementations for image.

Namespace

Drupal\image\Hook

Code

public function fileMove(FileInterface $file, FileInterface $source) : void {
  // Delete any image derivatives at the original image path.
  image_path_flush($source->getFileUri());
}

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