You are here

public function Submission::__construct in Little helpers 7.2

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

Constructor.

Parameters

object $node_or_webform: Either a node-object or a Webform instance.

object $submission: A submission object as created by webform.

File

src/Webform/Submission.php, line 50

Class

Submission
A useful wrapper for webform submission objects.

Namespace

Drupal\little_helpers\Webform

Code

public function __construct($node_or_webform, $submission) {
  $this->submission = $submission;
  if ($node_or_webform instanceof Webform) {
    $this->node = $node_or_webform->node;
    $this->webform = $node_or_webform;
  }
  else {
    $this->node = $node_or_webform;
    $this->webform = new Webform($node_or_webform);
  }
  if (!isset($submission->tracking)) {
    $submission->tracking = (object) [];
  }
}