You are here

public static function Submission::load in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/Webform/Submission.php \Drupal\little_helpers\Webform\Submission::load()

Load a submission object based on it's $nid and $sid.

Parameters

int $nid: Node ID of the submission.

int $sid: Submission ID.

bool $reset: Whether to reset the static cache from webform_get_submission(). Pass this if you are batch-processing submissions.

Return value

\Drupal\little_helpers\Webform\Submission The submission or NULL if the no submission could be loaded.

3 calls to Submission::load()
SubmissionIntegrationTest::testDelete in tests/Webform/SubmissionIntegrationTest.php
Test deleting a submission.
SubmissionIntegrationTest::testSaveUpdate in tests/Webform/SubmissionIntegrationTest.php
Test modifying a submission.
_little_helpers_webform_redirect_alter in ./little_helpers.module
Form submission handler: Let other modules alter the redirect.

File

src/Webform/Submission.php, line 30

Class

Submission
A useful wrapper for webform submission objects.

Namespace

Drupal\little_helpers\Webform

Code

public static function load($nid, $sid, $reset = FALSE) {

  // Neither node_load() nor webform_get_submission() can handle invalid IDs.
  if (!$nid || !$sid) {
    return NULL;
  }
  $node = node_load($nid);
  $submission = webform_get_submission($nid, $sid, $reset);
  if ($node && $submission) {
    return new static($node, $submission);
  }
}