public static function PhotosImage::preDelete in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Entity/PhotosImage.php \Drupal\photos\Entity\PhotosImage::preDelete()
Acts on entities before they are deleted and before hooks are invoked.
Used before the entities are deleted and before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides EntityBase::preDelete
File
- src/
Entity/ PhotosImage.php, line 142
Class
- PhotosImage
- Defines the photos image entity class.
Namespace
Drupal\photos\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
parent::preDelete($storage, $entities);
// @see PhotosImage::delete.
// @todo move count updates to entity delete form?
foreach ($entities as $entity) {
$album_id = $entity
->getAlbumId();
// Clear cache.
Cache::invalidateTags([
'node:' . $album_id,
'photos:album:' . $album_id,
]);
Cache::invalidateTags([
'photos:image:' . $entity
->id(),
]);
}
}