You are here

public function FileUrlGenerator::generateAbsoluteString in Drupal 9

Creates an absolute web-accessible URL string.

Parameters

string $uri: The URI to a file for which we need an external URL, or the path to a shipped file.

Return value

string An absolute string containing a URL that may be used to access the file.

Throws

\Drupal\Core\File\Exception\InvalidStreamWrapperException If a stream wrapper could not be found to generate an external URL.

Overrides FileUrlGeneratorInterface::generateAbsoluteString

File

core/lib/Drupal/Core/File/FileUrlGenerator.php, line 65

Class

FileUrlGenerator
Default implementation for the file URL generator service.

Namespace

Drupal\Core\File

Code

public function generateAbsoluteString(string $uri) : string {
  return $this
    ->doGenerateString($uri, FALSE);
}