diff options
-rw-r--r-- | modules/node/node.module | 33 | ||||
-rw-r--r-- | modules/node/node.pages.inc | 33 |
2 files changed, 33 insertions, 33 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 36cc76dcd..6c3609bab 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -887,6 +887,39 @@ function node_load($nid = NULL, $vid = NULL, $reset = FALSE) { } /** + * Prepares a node object for editing. + * + * Fills in a few default values, and then invokes hook_prepare() on the node + * type module, and hook_node_prepare() on all modules. + */ +function node_object_prepare($node) { + // Set up default values, if required. + $node_options = variable_get('node_options_' . $node->type, array('status', 'promote')); + // If this is a new node, fill in the default values. + if (!isset($node->nid) || isset($node->is_new)) { + foreach (array('status', 'promote', 'sticky') as $key) { + // Multistep node forms might have filled in something already. + if (!isset($node->$key)) { + $node->$key = (int) in_array($key, $node_options); + } + } + global $user; + $node->uid = $user->uid; + $node->created = REQUEST_TIME; + } + else { + $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O'); + // Remove the log message from the original node object. + $node->log = NULL; + } + // Always use the default revision setting. + $node->revision = in_array('revision', $node_options); + + node_invoke($node, 'prepare'); + module_invoke_all('node_prepare', $node); +} + +/** * Perform validation checks on the given node. */ function node_validate($node, $form = array()) { diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index b13ba4dd0..8030a571a 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -81,39 +81,6 @@ function node_form_validate($form, &$form_state) { } /** - * Prepares a node object for editing. - * - * Fills in a few default values, and then invokes hook_prepare() on the node - * type module, and hook_node_prepare() on all modules. - */ -function node_object_prepare($node) { - // Set up default values, if required. - $node_options = variable_get('node_options_' . $node->type, array('status', 'promote')); - // If this is a new node, fill in the default values. - if (!isset($node->nid) || isset($node->is_new)) { - foreach (array('status', 'promote', 'sticky') as $key) { - // Multistep node forms might have filled in something already. - if (!isset($node->$key)) { - $node->$key = (int) in_array($key, $node_options); - } - } - global $user; - $node->uid = $user->uid; - $node->created = REQUEST_TIME; - } - else { - $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O'); - // Remove the log message from the original node object. - $node->log = NULL; - } - // Always use the default revision setting. - $node->revision = in_array('revision', $node_options); - - node_invoke($node, 'prepare'); - module_invoke_all('node_prepare', $node); -} - -/** * Generate the node add/edit form array. */ function node_form($form, &$form_state, $node) { |