DEFINITION: hook_delete_confirm($nids) DESCRIPTION: Inject module-specific data into the delete confirmation screen. Note: This hook operates prior to the actual deletion of nodes, allowing modules to place both informational messages and control structures into the confirmation step of the process. The hook is called for both single node deletions and admin batch deletions. PARAMETERS $nids An array of the node IDs selected for deletion. RETURN VALUE An array, the elements of which are also an array with the following key/value pairs: key: the node ID for which the data is to be injected value: the data to inject for the specified node ID ex. array(array(12 => 'This is the last one of it's kind!', 27 => form_textfield('Enter log message for this deletion', 'logmessage][27', '', 40, 40))); CODE EXAMPLES: This example demonstrates how to inject custom messages into the delete confirmation screen: function hook_delete_confirm($nids) { //create the data_to_inject array, and query the table for any matching nodes passed in //from the node array $data_to_inject = array(); $nodes_inject = db_query('SELECT nid FROM {foo} WHERE nid IN(%s)', implode(',',$nids)); //for any nodes that need delete confirm data injected, add each nodes data to the data_to_inject array. while ($node = db_fetch_object($nodes_inject)) { if ($user_signups = db_num_rows(db_query('SELECT nid FROM {bar} WHERE nid = %d', $node->nid))) { $data_to_inject[$node->nid] = '

'.t('Warning:').'

'.t('%d user(s) signed up for this event!', array('%d'=>$user_signups)); } else { $data_to_inject[$node->nid] = '

'.t('0 Signups:').'

'.t('No users signed up for this event.'); } } return array($data_to_inject); } This example demonstrates how to inject a custom control structure into the delete confirmation screen: function hook_delete_confirm($nids) { //create the data_to_inject and option arrays, and query the table for any matching nodes passed in //from the node_array $data_to_inject = array(); $options = array('this' => t('This occurance only'), 'future' => t('This occurance and all future occurances'), 'all' => t('All occurances') ); $nodes_inject = db_query('SELECT nid FROM {foo} WHERE nid IN(%s)', implode(',',$nids)); //for any nodes that need delete confirm data injected, construct the radio buttons and add each nodes data //to the data_to_inject array. NOTE: in order to prevent name collisions in the admin //delete process for multiple nodes, these HTML elements are named in array fashion, with nid to distinguish //the elements of the array while ($node = db_fetch_object($nodes_inject)) { $data_to_inject[$node->nid] = form_radios(t('Repeat event--delete the following:'), 'eventrepeat_delete_type]['.$node->nid, 'this', $options); } return array($data_to_inject); } IMPORTANT NOTE: When deletion occurs the control structure's data will be available via the $_POST['edit'] array. It's highly recommended to unset the value for the control structure once it's data has been captured to avoid the possibility of endless loops.