node_multiple_delete_confirm

5 node.module node_multiple_delete_confirm()
6 node.admin.inc node_multiple_delete_confirm(&$form_state, $nodes)
7 node.admin.inc node_multiple_delete_confirm($form, &$form_state, $nodes)
8 node.admin.inc node_multiple_delete_confirm($form, &$form_state, $nodes)

1 string reference to 'node_multiple_delete_confirm'

File

modules/node/node.module, line 1687
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_multiple_delete_confirm() {
  $edit = $_POST;

  $form['nodes'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );
  // array_filter returns only elements with TRUE values
  foreach (array_filter($edit['nodes']) as $nid => $value) {
    $title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
    $form['nodes'][$nid] = array(
      '#type' => 'hidden',
      '#value' => $nid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($title) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );

  return confirm_form($form, 
                      t('Are you sure you want to delete these items?'), 
                      'admin/content/node', t('This action cannot be undone.'), 
                      t('Delete all'), t('Cancel'));
}
Login or register to post comments