Commit ab7fb800 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#216061 by Eaton: nid was not set in node creation (programatic node creation regression)

parent c306d56a
......@@ -274,12 +274,13 @@ function form_set_cache($form_build_id, $form, $form_state) {
*
* // Create a new node
* $form_state = array();
* module_load_include('inc', 'node', 'node.pages');
* $node = array('type' => 'story');
* $form_state['values']['title'] = 'My node';
* $form_state['values']['body'] = 'This is the body text!';
* $form_state['values']['name'] = 'robo-user';
* $form_state['values']['op'] = t('Save');
* drupal_execute('story_node_form', $form_state, $node);
* drupal_execute('story_node_form', $form_state, (object)$node);
*/
function drupal_execute($form_id, &$form_state) {
$args = func_get_args();
......
......@@ -464,6 +464,7 @@ function node_form_submit($form, &$form_state) {
}
if ($node->nid) {
unset($form_state['rebuild']);
$form_state['nid'] = $node->nid;
$form_state['redirect'] = 'node/'. $node->nid;
}
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment