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

Invokes a hook on behalf of the entity.

Parameters

string $hook: One of 'create', 'presave', 'insert', 'update', 'predelete', 'delete', or 'revision_delete'.

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

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
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 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);
}