You are here

function revision_deletion_admin_overview_confirm in Revision Deletion 7

List the selected revisions and verify that the admin wants to delete them.

2 calls to revision_deletion_admin_overview_confirm()
revision_deletion_admin_overview in ./revision_deletion.admin.inc
Form builder for the revisions overview administration form.
revision_deletion_node_overview in ./revision_deletion.admin.inc
Form builder for the node revisions administration form.

File

./revision_deletion.admin.inc, line 181

Code

function revision_deletion_admin_overview_confirm(&$form_state, $destination) {
  $form = array();
  $form['destination'] = array(
    '#type' => 'hidden',
    '#value' => $destination,
  );
  $form['display'] = array(
    '#type' => 'item',
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );
  $revision_counter = 0;
  $edit = $form_state['values'];
  foreach (array_filter($edit['revisions']) as $nid => $value) {

    // ### ($nid);.
    $node = node_load(NULL, $nid);
    if (is_object($node) && is_numeric($node->nid)) {
      $form['display'][$nid] = array(
        '#type' => 'item',
        '#markup' => '<strong>' . check_plain($node->title) . '</strong> ' . t('(node: @node, revision: @revision)', array(
          '@node' => $node->nid,
          '@revision' => $node->vid,
        )),
        '#prefix' => '<li>',
        '#suffix' => '</li>',
      );
      $revision_counter++;
    }
  }
  if ($revision_counter == 0) {
    drupal_set_message(t('There do not appear to be any revisions to delete or your selected revisions were deleted by another administrator.'), 'warning');
    drupal_goto($destination);
  }
  else {
    return confirm_form($form, t('Are you sure you want to delete the selected revisions?'), isset($_GET['destination']) ? $_GET['destination'] : $destination, NULL, t('Delete'));
  }
}