You are here

function webform_get_submission in Webform 6.3

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

Fetch a specified submission for a webform node.

6 calls to webform_get_submission()
WebformSubmissionTestCase::webformSubmissionExecute in tests/submission.test
Execute the submission test.
webform_client_form in ./webform.module
Client form generation function. If this is displaying an existing submission, pass in the $submission variable with the contents of the submission to be displayed.
webform_client_form_submit in ./webform.module
Submit handler for saving the form values and sending e-mails.
webform_menu_submission_load in ./webform.module
Menu loader callback. Load a webform submission if the given sid is a valid.
webform_node_view in ./webform.module
Implements hook_node_view().

... See full list

File

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

Code

function webform_get_submission($nid, $sid, $reset = FALSE) {
  static $submissions = array();
  if ($reset) {
    $submissions = array();
    if (!isset($sid)) {
      return;
    }
  }

  // Load the submission if needed.
  if (!isset($submissions[$sid])) {
    $new_submissions = webform_get_submissions(array(
      'nid' => $nid,
      'sid' => $sid,
    ));
    $submissions[$sid] = isset($new_submissions[$sid]) ? $new_submissions[$sid] : FALSE;
  }
  return $submissions[$sid];
}