1 entity.controller.inc protected EntityDatabaseStorageController::invokeHook($hook, EntityInterface $entity)

Invokes a hook on behalf of the entity.

Parameters

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

$entity: The entity object.

File

core/modules/entity/entity.controller.inc, line 834
Entity API controller classes and interface.

Class

EntityDatabaseStorageController
Implements the entity storage controller interface for the database.

Code

protected function invokeHook($hook, EntityInterface $entity) {
  if (!empty($this->entityInfo['fieldable']) && function_exists($function = 'field_attach_' . $hook)) {
    $function($this->entityType, $entity);
  }
  // Invoke the hook.
  module_invoke_all($this->entityType . '_' . $hook, $entity);
  // Invoke the respective entity-level hook.
  module_invoke_all('entity_' . $hook, $entity, $this->entityType);
}