function ContentEntityBase::postSave

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::postSave()
  2. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::postSave()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::postSave()

Overrides EntityBase::postSave

9 calls to ContentEntityBase::postSave()
BlockContent::postSave in core/modules/block_content/src/Entity/BlockContent.php
Acts on a saved entity before the insert or update hook is invoked.
Comment::postSave in core/modules/comment/src/Entity/Comment.php
Acts on a saved entity before the insert or update hook is invoked.
Item::postSave in core/modules/aggregator/src/Entity/Item.php
Acts on a saved entity before the insert or update hook is invoked.
Media::postSave in core/modules/media/src/Entity/Media.php
Acts on a saved entity before the insert or update hook is invoked.
MenuLinkContent::postSave in core/modules/menu_link_content/src/Entity/MenuLinkContent.php
Acts on a saved entity before the insert or update hook is invoked.

... See full list

9 methods override ContentEntityBase::postSave()
BlockContent::postSave in core/modules/block_content/src/Entity/BlockContent.php
Acts on a saved entity before the insert or update hook is invoked.
Comment::postSave in core/modules/comment/src/Entity/Comment.php
Acts on a saved entity before the insert or update hook is invoked.
Item::postSave in core/modules/aggregator/src/Entity/Item.php
Acts on a saved entity before the insert or update hook is invoked.
Media::postSave in core/modules/media/src/Entity/Media.php
Acts on a saved entity before the insert or update hook is invoked.
MenuLinkContent::postSave in core/modules/menu_link_content/src/Entity/MenuLinkContent.php
Acts on a saved entity before the insert or update hook is invoked.

... See full list

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 462

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);
    // Update the status of all saved translations.
    $removed = [];
    foreach ($this->translations as $langcode => &$data) {
        if ($data['status'] == static::TRANSLATION_REMOVED) {
            $removed[$langcode] = TRUE;
        }
        else {
            $data['status'] = static::TRANSLATION_EXISTING;
        }
    }
    $this->translations = array_diff_key($this->translations, $removed);
    // Reset the new revision flag.
    $this->newRevision = FALSE;
    // Reset the enforcement of the revision translation affected flag.
    $this->enforceRevisionTranslationAffected = [];
}

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