function ImageStyle::postSave

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

Overrides EntityBase::postSave

File

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

Class

ImageStyle
Defines an image style configuration entity.

Namespace

Drupal\image\Entity

Code

public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);
    if ($update) {
        if (!empty($this->original) && $this->id() !== $this->original
            ->id()) {
            // The old image style name needs flushing after a rename.
            $this->original
                ->flush();
            // Update field settings if necessary.
            if (!$this->isSyncing()) {
                static::replaceImageStyle($this);
            }
        }
        else {
            // Flush image style when updating without changing the name.
            $this->flush();
        }
    }
}

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