function ContentEntityStorageBase::invokeHook

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

Overrides EntityStorageBase::invokeHook

5 calls to ContentEntityStorageBase::invokeHook()
ContentEntityStorageBase::create in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Constructs a new entity object, without permanently saving it.
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
Deletes 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 invokes the related hooks if needed.

File

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

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.