function PublicStream::getExternalUrl

Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl().

Return value

string Returns the HTML URI of a public file.

Overrides StreamWrapperInterface::getExternalUrl

File

drupal/core/lib/Drupal/Core/StreamWrapper/PublicStream.php, line 31
Definition of Drupal\Core\StreamWrapper\PublicStream.

Class

PublicStream
Defines a Drupal public (public://) stream wrapper class.

Namespace

Drupal\Core\StreamWrapper

Code

function getExternalUrl() {
  $path = str_replace('\\', '/', $this
    ->getTarget());
  return $GLOBALS['base_url'] . '/' . self::getDirectoryPath() . '/' . drupal_encode_path($path);
}