function ContentEntityBase::postSave

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::postSave()
  2. 8.9.x 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

8 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.
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.
Node::postSave in core/modules/node/src/Entity/Node.php
Acts on a saved entity before the insert or update hook is invoked.

... See full list

8 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.
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.
Node::postSave in core/modules/node/src/Entity/Node.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 491

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.