You are here

function media_thumbnails_media_delete in Media Thumbnails 8

Implements hook_ENTITY_TYPE_delete().

File

./media_thumbnails.module, line 44
Plugin manager for media entity thumbnail generation.

Code

function media_thumbnails_media_delete(MediaInterface $entity) {

  /** @var \Drupal\media_thumbnails\Plugin\MediaThumbnailManager $manager */
  $manager = \Drupal::service('plugin.manager.media_thumbnail');
  if ($manager
    ->hasPlugin($entity)) {
    $manager
      ->deleteThumbnail($entity);
  }
}