1.20.x node.api.php hook_prepare(Node $node)

Act on a node object about to be shown on the add/edit form.

This is a node-type-specific hook, which is invoked only for the node type being affected. See Node API hooks for more information.

Use hook_node_prepare() to respond to node preparation of all node types.

This hook is invoked from node_object_prepare() before the general hook_node_prepare() is invoked.

Parameters

Node $node: The node that is about to be shown on the add/edit form.

Related topics

File

modules/node/node.api.php, line 1016
Hooks provided by the Node module.

Code

function hook_prepare(Node $node) {
  if (!isset($node->mymodule_value)) {
    $node->mymodule_value = 'foo';
  }
}