| Versions | |
|---|---|
| 4.7 | node_delete_confirm() |
| 5 | node_delete_confirm($node) |
| 6 | node_delete_confirm(&$form_state, $node) |
| 7 | node_delete_confirm($form, &$form_state, $node) |
Menu callback -- ask for confirmation of node deletion
modules/
<?php
function node_delete_confirm() {
$edit = $_POST['edit'];
$edit['nid'] = $edit['nid'] ? $edit['nid'] : arg(1);
$node = node_load($edit['nid']);
if (node_access('delete', $node)) {
$form['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);
$output = confirm_form('node_delete_confirm', $form,
t('Are you sure you want to delete %title?', array('%title' => theme('placeholder', $node->title))),
$_GET['destination'] ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'),
t('Delete'), t('Cancel') );
}
return $output;
}
?>