function ImageStyle::postDelete

Same name in other branches
  1. 8.9.x core/modules/image/src/Entity/ImageStyle.php \Drupal\image\Entity\ImageStyle::postDelete()
  2. 10 core/modules/image/src/Entity/ImageStyle.php \Drupal\image\Entity\ImageStyle::postDelete()
  3. 11.x core/modules/image/src/Entity/ImageStyle.php \Drupal\image\Entity\ImageStyle::postDelete()

Overrides EntityBase::postDelete

File

core/modules/image/src/Entity/ImageStyle.php, line 129

Class

ImageStyle
Defines an image style configuration entity.

Namespace

Drupal\image\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage, $entities);
    
    /** @var \Drupal\image\ImageStyleInterface[] $entities */
    foreach ($entities as $style) {
        // Flush cached media for the deleted style.
        $style->flush();
        // Clear the replacement ID, if one has been previously stored.
        
        /** @var \Drupal\image\ImageStyleStorageInterface $storage */
        $storage->clearReplacementId($style->id());
    }
}

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