public function FlysystemUrlTrait::getExternalUrl in Flysystem 8
Same name and namespace in other branches
- 3.x src/Plugin/FlysystemUrlTrait.php \Drupal\flysystem\Plugin\FlysystemUrlTrait::getExternalUrl()
- 2.0.x src/Plugin/FlysystemUrlTrait.php \Drupal\flysystem\Plugin\FlysystemUrlTrait::getExternalUrl()
- 3.0.x src/Plugin/FlysystemUrlTrait.php \Drupal\flysystem\Plugin\FlysystemUrlTrait::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://xIpLd0WQKCY" might be "http://www.youtube.com/watch?v=xIpLd0WQKCY".
Parameters
string $uri: The URI to provide a URL for.
Return value
string Returns a string containing a web accessible URL for the resource.
1 call to FlysystemUrlTrait::getExternalUrl()
- Local::getExternalUrl in src/
Flysystem/ Local.php - Returns a web accessible URL for the resource.
File
- src/
Plugin/ FlysystemUrlTrait.php, line 27
Class
- FlysystemUrlTrait
- Helper trait for generating URLs from adapter plugins.
Namespace
Drupal\flysystem\PluginCode
public function getExternalUrl($uri) {
$path = str_replace('\\', '/', $this
->getTarget($uri));
$arguments = [
'scheme' => $this
->getScheme($uri),
'filepath' => $path,
];
return Url::fromRoute('flysystem.serve', $arguments, [
'absolute' => TRUE,
])
->toString();
}