You are here

function webform_submission_uuid_entry in Webform Submission UUID 7

Get's the webform submission entry provided a uuid.

Parameters

string $uuid:

bool $reset:

Return value

array An array of submissions stubs (having only the nid and sid attributes) keyed by UUID. An empty array is returned if no matching submission is found.

2 calls to webform_submission_uuid_entry()
webform_submission_uuid_submission in ./webform_submission_uuid.module
Loads a webform submission provided the UUID.
webform_submission_uuid_webform in ./webform_submission_uuid.module
Loads a webform provided the UUID of the submission.

File

./webform_submission_uuid.module, line 31

Code

function webform_submission_uuid_entry($uuid, $reset = FALSE) {

  // Get the submissions from static cache.
  $submissions =& drupal_static(__FUNCTION__);

  // See if we need to reset or if it is statically cached.
  if ($reset || empty($submissions[$uuid])) {

    // Get the nid and sid for this uuid.
    $result = db_select('webform_submissions', 's')
      ->fields('s', array(
      'sid',
      'nid',
    ))
      ->condition('s.uuid', $uuid)
      ->execute();

    // Make sure we have a result.
    if ($row = $result
      ->fetchObject()) {

      // Add the result to the static cache.
      $submissions[$uuid] = $row;
    }
  }

  // Return the submission.
  return !empty($submissions[$uuid]) ? $submissions[$uuid] : array();
}