You'll need to create a simple module containing two files to do this. Create a new directory "addmore" in your /sites/all/modules/custom folder (create that folder if it doesn't exist) and create the following files in that directory:
- addmore.info
- addmore.module
Contents of addmore.info:
name = "Add More"
description = Create and Add More button on Child node forms
package = Other
core = 6.x
Contents of addmore.module (Assumes that the machine name of the "Child" content type is "child")
<?php
/**
* Implementation of HOOK_form_alter
*
* For 'child' node forms, add a new button to the bottons array that submits
* and saves the node, but redirects to the node/add/child form instead of to
* the newly created node.
*/
function addmore_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'child_node_form') {
$form['buttons']['save_and_add_more'] = array(
'#type' => 'submit',
'#value' => t('Save and add more'),
'#weight' => 20,
'#submit' => array(
// Adds the existing form submit function from the regular "Save" button
$form['buttons']['submit']['#submit'][0],
// Add our custom function which will redirect to the node/add/child form
'addmore_add_another',
),
);
}
}
/**
* Custom function called when a user saves a "child" node using the "Save and
* add more" button. Directs users to node/add/child instead of the newly
* created node.
*/
function addmore_add_another() {
drupal_goto('node/add/child');
}
Once you have created these files, navigate to your modules page and enable the "Add More" module.
That's it. You'll see a new "Save and add more" button which does just that on Child node creation and edit forms.