You are here

public function YamlFormSubmission::getSourceEntity in YAML Form 8

Gets the form submission's source entity.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity that this form submission was created from.

Overrides YamlFormSubmissionInterface::getSourceEntity

2 calls to YamlFormSubmission::getSourceEntity()
YamlFormSubmission::getSourceUrl in src/Entity/YamlFormSubmission.php
Gets the form submission's source URL.
YamlFormSubmission::label in src/Entity/YamlFormSubmission.php
Gets the label of the entity.

File

src/Entity/YamlFormSubmission.php, line 391

Class

YamlFormSubmission
Defines the YamlFormSubmission entity.

Namespace

Drupal\yamlform\Entity

Code

public function getSourceEntity() {
  if ($this->entity_type->value && $this->entity_id->value) {
    $entity_type = $this->entity_type->value;
    $entity_id = $this->entity_id->value;
    return $this
      ->entityTypeManager()
      ->getStorage($entity_type)
      ->load($entity_id);
  }
  else {
    return NULL;
  }
}