1 node.admin.inc | node_multiple_delete_confirm($form, &$form_state) |
Multiple node deletion confirmation form.
See also
node_multiple_delete_confirm_submit()
Related topics
File
- core/
modules/ node/ node.admin.inc, line 165 - Admin page callbacks for the Node module.
Code
function node_multiple_delete_confirm($form, &$form_state) {
if (isset($form_state['nids'])) {
$nids = $form_state['nids'];
}
elseif (isset($_SESSION['node_delete_action']['timestamp']) && (REQUEST_TIME - $_SESSION['node_delete_action']['timestamp'] < 6000)) {
$nids = $_SESSION['node_delete_action']['nids'];
$form_state['nids'] = $nids;
$form_state['cache'] = TRUE;
unset($_SESSION['node_delete_action']);
}
else {
$nids = array();
}
$form['#tree'] = TRUE;
if (empty($nids)) {
$destination = isset($_GET['destination']) ? $_GET['destination'] : 'admin/content/node';
$form['empty']['#markup'] = '<p>' . t('Return to the <a href="!url">content administration page</a>.', array('!url' => url($destination))) . '</p>';
backdrop_set_message(t('No content has been selected for deletion.'), 'error');
return $form;
}
$form['node_list'] = array(
'#theme' => 'item_list',
'#items' => array(),
);
$rows = db_query('SELECT nid, title FROM {node} WHERE nid IN (:nids)', array(':nids' => $nids))->fetchAllKeyed();
foreach ($rows as $nid => $title) {
$form['nodes'][$nid] = array(
'#type' => 'hidden',
'#value' => $nid,
);
$form['node_list']['#items'][] = check_plain($title);
}
$confirm_question = format_plural(count($rows), 'Are you sure you want to delete this content item?', 'Are you sure you want to delete these content items?');
return confirm_form($form, $confirm_question, 'admin/content', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}