function ContentEntityStorageBase::invokeHook

Same name and namespace in other branches
  1. 11.x 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. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeHook()

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.