You are here

public static function Submission::load in Little helpers 7

Same name and namespace in other branches
  1. 7.2 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.

1 call to Submission::load()
FormState::getSubmission in src/Webform/FormState.php

File

src/Webform/Submission.php, line 31

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);
  }
}