function ExtensionStreamBase::getExternalUrl
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://random_string" might be "http://www.youtube.com/watch?v=random_string".
Return value
string Returns a string containing a web accessible URL for the resource.
Overrides StreamWrapperInterface::getExternalUrl
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php, line 78
Class
- ExtensionStreamBase
- Defines a base stream wrapper implementation for extension assets.
Namespace
Drupal\Core\StreamWrapperCode
public function getExternalUrl() : string {
$dir = $this->getDirectoryPath();
return \Drupal::service(RequestContext::class)->getCompleteBaseUrl() . rtrim("/{$dir}/" . $this->getTarget(), '/');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.