FileUrlGenerator
class FileUrlGenerator implements FileUrlGeneratorInterface (View source)
Default implementation for the file URL generator service.
Properties
| protected StreamWrapperManagerInterface | $streamWrapperManager | The stream wrapper manager. |
|
| protected RequestStack | $requestStack | The request stack. |
|
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
Methods
Constructs a new file URL generator object.
Creates a root-relative web-accessible URL string.
Creates an absolute web-accessible URL string.
Creates an absolute web-accessible URL string.
Generate a URL path.
Transforms an absolute URL of a local file to a relative URL.
Details
__construct(StreamWrapperManagerInterface $stream_wrapper_manager, RequestStack $request_stack, ModuleHandlerInterface $module_handler)
Constructs a new file URL generator object.
string
generateString(string $uri)
Creates a root-relative web-accessible URL string.
string
generateAbsoluteString(string $uri)
Creates an absolute web-accessible URL string.
protected string
doGenerateString(string $uri, bool $relative)
Creates an absolute web-accessible URL string.
protected string
generatePath(string $base_url, string $uri)
Generate a URL path.
Url
generate(string $uri)
Creates a root-relative web-accessible URL object.
string
transformRelative(string $file_url, bool $root_relative = TRUE)
Transforms an absolute URL of a local file to a relative URL.
May be useful to prevent problems on multisite set-ups and prevent mixed content errors when using HTTPS + HTTP.