You are here

protected function Image::deleteImage in SimpleAds 8

Delete file entity.

1 call to Image::deleteImage()
Image::deleteFormSubmit in src/Plugin/SimpleAds/Type/Image.php
Delete an ad.

File

src/Plugin/SimpleAds/Type/Image.php, line 106

Class

Image
Image Ad type.

Namespace

Drupal\simpleads\Plugin\SimpleAds\Type

Code

protected function deleteImage($fid) {
  $file = File::load($fid);
  $file_usage = \Drupal::service('file.usage');
  $file_usage
    ->add($file, 'simpleads', 'file', $fid);
  $file
    ->delete();
  return $fid;
}