You are here

function node_multiple_delete_confirm in Drupal 7

Same name and namespace in other branches
  1. 4 modules/node.module \node_multiple_delete_confirm()
  2. 5 modules/node/node.module \node_multiple_delete_confirm()
  3. 6 modules/node/node.admin.inc \node_multiple_delete_confirm()

Multiple node deletion confirmation form for node_admin_content().

See also

node_admin_nodes()

node_admin_nodes_submit()

node_admin_nodes_validate()

node_filter_form()

node_filter_form_submit()

node_multiple_delete_confirm_submit()

Related topics

1 call to node_multiple_delete_confirm()
node_admin_content in modules/node/node.admin.inc
Page callback: Form constructor for the content administration form.

File

modules/node/node.admin.inc, line 670
Content administration and module settings UI.

Code

function node_multiple_delete_confirm($form, &$form_state, $nodes) {
  $form['nodes'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  foreach ($nodes as $nid => $value) {
    $title = db_query('SELECT title FROM {node} WHERE nid = :nid', array(
      ':nid' => $nid,
    ))
      ->fetchField();
    $form['nodes'][$nid] = array(
      '#type' => 'hidden',
      '#value' => $nid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($title) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  $form['#submit'][] = 'node_multiple_delete_confirm_submit';
  $confirm_question = format_plural(count($nodes), 'Are you sure you want to delete this item?', 'Are you sure you want to delete these items?');
  return confirm_form($form, $confirm_question, 'admin/content', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}