function node_invoke

Invokes a node hook.

Parameters

\Drupal\Core\Entity\EntityInterface $node: A Node entity.

$hook: A string containing the name of the hook.

$a2, $a3, $a4: (optional) Arguments to pass on to the hook, after the $node argument. All default to NULL.

Return value

The returned value of the invoked hook.

3 calls to node_invoke()
NodeFormController::prepareEntity in drupal/core/modules/node/lib/Drupal/node/NodeFormController.php
Prepares the node object.
NodeRenderController::buildContent in drupal/core/modules/node/lib/Drupal/node/NodeRenderController.php
Overrides Drupal\Core\Entity\EntityRenderController::buildContent().
NodeStorageController::invokeHook in drupal/core/modules/node/lib/Drupal/node/NodeStorageController.php
Overrides Drupal\Core\Entity\DatabaseStorageController::invokeHook().

File

drupal/core/modules/node/node.module, line 888
The core module that allows content to be submitted to the site.

Code

function node_invoke(EntityInterface $node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
  if ($function = node_hook($node->type, $hook)) {
    return $function($node, $a2, $a3, $a4);
  }
}