You are here

protected function ContentEntityStorageBase::invokeHook in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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

4 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.

File

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

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