You are here

public function FileUrlGeneratorInterface::generateString in Drupal 9

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/File/FileUrlGeneratorInterface.php \Drupal\Core\File\FileUrlGeneratorInterface::generateString()

Creates a root-relative 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 For a local URL (matching domain), a root-relative string containing a URL that may be used to access the file. An absolute URL may be returned when using a CDN or a remote stream wrapper.

Throws

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

1 method overrides FileUrlGeneratorInterface::generateString()
FileUrlGenerator::generateString in core/lib/Drupal/Core/File/FileUrlGenerator.php
Creates a root-relative web-accessible URL string.

File

core/lib/Drupal/Core/File/FileUrlGeneratorInterface.php, line 41

Class

FileUrlGeneratorInterface
Generates file URLs for a stream to an external or local file.

Namespace

Drupal\Core\File

Code

public function generateString(string $uri) : string;