You are here

protected function FillPdfLinkManipulator::createUrlFromString in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/Service/FillPdfLinkManipulator.php \Drupal\fillpdf\Service\FillPdfLinkManipulator::createUrlFromString()

Creates a URL object from an internal path or external URL.

Parameters

string $url: The internal path or external URL string.

Return value

\Drupal\Core\Url A Url object representing the URL string.

See also

FillPdfLinkManipulatorInterface::parseUrlString()

2 calls to FillPdfLinkManipulator::createUrlFromString()
FillPdfLinkManipulator::parseRequest in src/Service/FillPdfLinkManipulator.php
@todo: Maybe this should return a FillPdfLinkContext object or something? Guess it depends on how much I end up needing to change it.
FillPdfLinkManipulator::parseUrlString in src/Service/FillPdfLinkManipulator.php
Parses a root-relative URL.

File

src/Service/FillPdfLinkManipulator.php, line 49

Class

FillPdfLinkManipulator

Namespace

Drupal\fillpdf\Service

Code

protected function createUrlFromString($url) {
  $url_parts = UrlHelper::parse($url);
  $path = $url_parts['path'];
  $query = $url_parts['query'];
  $link = Url::fromUri($path, [
    'query' => $query,
  ]);
  return $link;
}