You are here

public function WebformSubmission::getSourceUrl in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Entity/WebformSubmission.php \Drupal\webform\Entity\WebformSubmission::getSourceUrl()

Gets the webform submission's source URL.

Return value

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

Overrides WebformSubmissionInterface::getSourceUrl

1 call to WebformSubmission::getSourceUrl()
WebformSubmission::getTokenUrl in src/Entity/WebformSubmission.php
Gets the webform submission's secure tokenized URL.

File

src/Entity/WebformSubmission.php, line 546

Class

WebformSubmission
Defines the WebformSubmission entity.

Namespace

Drupal\webform\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()) && $entity
    ->hasLinkTemplate('canonical')) {
    return $entity
      ->toUrl()
      ->setOption('absolute', TRUE);
  }
  else {
    return $this
      ->getWebform()
      ->toUrl()
      ->setOption('absolute', TRUE);
  }
}