You are here

public function YamlFormSubmission::getSourceUrl in YAML Form 8

Gets the form submission's source URL.

Return value

\Drupal\Core\Url|false The source URL.

Overrides YamlFormSubmissionInterface::getSourceUrl

File

src/Entity/YamlFormSubmission.php, line 405

Class

YamlFormSubmission
Defines the YamlFormSubmission entity.

Namespace

Drupal\yamlform\Entity

Code

public function getSourceUrl() {
  $uri = $this->uri->value;
  if ($uri !== NULL && ($url = \Drupal::pathValidator()
    ->getUrlIfValid($uri))) {
    return $url
      ->setOption('absolute', TRUE);
  }
  elseif ($entity = $this
    ->getSourceEntity()) {
    return $entity
      ->toUrl()
      ->setOption('absolute', TRUE);
  }
  else {
    return $this
      ->getYamlForm()
      ->toUrl()
      ->setOption('absolute', TRUE);
  }
}