function ContentEntityStorageBase::invokeHook

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeHook()
  2. 10 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeHook()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeHook()

Overrides EntityStorageBase::invokeHook

5 calls to ContentEntityStorageBase::invokeHook()
ContentEntityStorageBase::createTranslation in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Constructs a new entity translation object, without permanently saving it.
ContentEntityStorageBase::deleteRevision in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Delete a specific entity revision.
ContentEntityStorageBase::initFieldValues in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Initializes field values.
ContentEntityStorageBase::invokeTranslationHooks in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Checks translation statuses and invoke the related hooks if needed.
PathAliasStorage::invokeHook in core/modules/path_alias/src/PathAliasStorage.php
Invokes a hook on behalf of the entity.
1 method overrides ContentEntityStorageBase::invokeHook()
PathAliasStorage::invokeHook in core/modules/path_alias/src/PathAliasStorage.php
Invokes a hook on behalf of the entity.

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 826

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

protected function invokeHook($hook, EntityInterface $entity) {
    
    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    switch ($hook) {
        case 'presave':
            $this->invokeFieldMethod('preSave', $entity);
            break;
        case 'insert':
            $this->invokeFieldPostSave($entity, FALSE);
            break;
        case 'update':
            $this->invokeFieldPostSave($entity, TRUE);
            break;
    }
    parent::invokeHook($hook, $entity);
}

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