public function VendorStreamWrapper::getExternalUrl in Vendor Stream Wrapper 8
Returns a web accessible URL for the resource.
This function should return a URL that can be embedded in a web page and accessed from a browser. For example, the external URL of "youtube://xIpLd0WQKCY" might be "http://www.youtube.com/watch?v=xIpLd0WQKCY".
Return value
string Returns a string containing a web accessible URL for the resource.
Overrides StreamWrapperInterface::getExternalUrl
File
- src/
StreamWrapper/ VendorStreamWrapper.php, line 33
Class
- VendorStreamWrapper
- Creates a vendor:// stream wrapper, for files in the vendor folder.
Namespace
Drupal\vendor_stream_wrapper\StreamWrapperCode
public function getExternalUrl() {
$path = str_replace('\\', '/', $this
->getTarget());
return Url::fromRoute('vendor_stream_wrapper.vendor_file_download', [
'filepath' => $path,
], [
'path_processing' => FALSE,
]);
}