Overrides Drupal\Core\Entity\DatabaseStorageController::invokeHook().
Overrides DatabaseStorageControllerNG::invokeHook
protected function invokeHook($hook, EntityInterface $node) {
$node = $node
->getBCEntity();
if ($hook == 'insert' || $hook == 'update') {
node_invoke($node, $hook);
}
else {
if ($hook == 'predelete') {
// 'delete' is triggered in 'predelete' is here to preserve hook ordering
// from Drupal 7.
node_invoke($node, 'delete');
}
}
// Inline parent::invokeHook() to pass on BC-entities to node-specific
// hooks.
$function = 'field_attach_' . $hook;
// @todo: field_attach_delete_revision() is named the wrong way round,
// consider renaming it.
if ($function == 'field_attach_revision_delete') {
$function = 'field_attach_delete_revision';
}
if (!empty($this->entityInfo['fieldable']) && function_exists($function)) {
$function($node);
}
// Invoke the hook.
module_invoke_all($this->entityType . '_' . $hook, $node);
// Invoke the respective entity-level hook.
module_invoke_all('entity_' . $hook, $node, $this->entityType);
}