function Shortcut::postSave

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

Overrides ContentEntityBase::postSave

File

core/modules/shortcut/src/Entity/Shortcut.php, line 99

Class

Shortcut
Defines the shortcut entity class.

Namespace

Drupal\shortcut\Entity

Code

public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);
    // EntityBase::postSave() calls EntityBase::invalidateTagsOnSave(), which
    // only handles the regular cases. The Shortcut entity has one special case:
    // a newly created shortcut is *also* added to a shortcut set, so we must
    // invalidate the associated shortcut set's cache tag.
    if (!$update) {
        Cache::invalidateTags($this->getCacheTagsToInvalidate());
    }
}

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