You are here

function hook_prepare in Drupal 7

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: The node that is about to be shown on the add/edit form.

Related topics

7 functions implement hook_prepare()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

book_node_prepare in modules/book/book.module
Implements hook_node_prepare().
callback_filter_prepare in modules/filter/filter.api.php
Provide prepared text with special characters escaped.
comment_node_prepare in modules/comment/comment.module
Implements hook_node_prepare().
entity_view_mode_prepare in includes/common.inc
Invoke hook_entity_view_mode_alter().
menu_node_prepare in modules/menu/menu.module
Implements hook_node_prepare().

... See full list

File

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

Code

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