You are here

public function WingsuitStreamWrapper::getExternalUrl in Gin Layout Builder 8.2

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/WingsuitStreamWrapper.php, line 62

Class

WingsuitStreamWrapper
Defines the read-only ws-assets:// stream wrapper for theme files.

Namespace

Drupal\wingsuit_companion\StreamWrapper

Code

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);
}