You are here

function webform_submission_delete_form in Webform 7.3

Same name and namespace in other branches
  1. 5.2 webform_submissions.inc \webform_submission_delete_form()
  2. 6.3 includes/webform.submissions.inc \webform_submission_delete_form()
  3. 6.2 webform_submissions.inc \webform_submission_delete_form()
  4. 7.4 includes/webform.submissions.inc \webform_submission_delete_form()

Confirm form to delete a single form submission.

Parameters

$form: The new form array.

$form_state: The current form state.

$node: The node for which this webform was submitted.

$submission: The submission to be deleted (from webform_submitted_data).

2 string references to 'webform_submission_delete_form'
webform_menu in ./webform.module
Implements hook_menu().
webform_mollom_form_list in ./webform.module
Implements hook_mollom_form_list().

File

includes/webform.submissions.inc, line 327
This file is loaded when handling submissions, either submitting new, editing, or viewing. It also contains all CRUD functions for submissions.

Code

function webform_submission_delete_form($form, $form_state, $node, $submission) {
  webform_set_breadcrumb($node, $submission);

  // Set the correct page title.
  drupal_set_title(webform_submission_title($node, $submission));

  // Keep the NID and SID in the same location as the webform_client_form().
  // This helps mollom identify the same fields when deleting a submission.
  $form['#tree'] = TRUE;
  $form['details']['nid'] = array(
    '#type' => 'value',
    '#value' => $node->nid,
  );
  $form['details']['sid'] = array(
    '#type' => 'value',
    '#value' => $submission->sid,
  );
  $question = t('Are you sure you want to delete this submission?');
  if (isset($_GET['destination'])) {
    $destination = $_GET['destination'];
  }
  elseif (webform_results_access($node)) {
    $destination = 'node/' . $node->nid . '/webform-results';
  }
  else {
    $destination = 'node/' . $node->nid . '/submissions';
  }
  return confirm_form($form, NULL, $destination, $question, t('Delete'), t('Cancel'));
}