function hook_node_prepare
Act on a node object about to be shown on the add/edit form.
This hook is invoked from node_object_prepare() after the type-specific hook_prepare() is invoked.
Parameters
$node: The node that is about to be shown on the add/edit form.
Related topics
4 functions implement hook_node_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().
- comment_node_prepare in modules/
comment/ comment.module - Implements hook_node_prepare().
- menu_node_prepare in modules/
menu/ menu.module - Implements hook_node_prepare().
- translation_node_prepare in modules/
translation/ translation.module - Implements hook_node_prepare().
1 invocation of hook_node_prepare()
- node_object_prepare in modules/
node/ node.module - Prepares a node object for editing.
File
-
modules/
node/ node.api.php, line 645
Code
function hook_node_prepare($node) {
if (!isset($node->comment)) {
$node->comment = variable_get("comment_{$node->type}", COMMENT_NODE_OPEN);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.