public function ExtensionStreamBase::getExternalUrl in System 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/ ExtensionStreamBase.php, line 64
Class
- ExtensionStreamBase
- Defines a base stream wrapper implementation.
Namespace
Drupal\system_stream_wrapper\StreamWrapperCode
public function getExternalUrl() {
$dir = $this
->getDirectoryPath();
if (empty($dir)) {
throw new \InvalidArgumentException("Extension directory for {$this->uri} does not exist.");
}
$path = rtrim(base_path() . $dir . '/' . $this
->getTarget(), '/');
return $this
->getRequest()
->getUriForPath($path);
}