function AssetsStream::baseUrl

Same name in other branches
  1. 10 core/lib/Drupal/Core/StreamWrapper/AssetsStream.php \Drupal\Core\StreamWrapper\AssetsStream::baseUrl()

Overrides PublicStream::baseUrl

File

core/lib/Drupal/Core/StreamWrapper/AssetsStream.php, line 51

Class

AssetsStream
Defines a Drupal stream wrapper class for optimized assets (assets://).

Namespace

Drupal\Core\StreamWrapper

Code

public static function baseUrl() : string {
    $public_path = Settings::get('file_public_path', 'sites/default/files');
    $path = Settings::get('file_assets_path', $public_path);
    if ($path === $public_path) {
        $base_url = PublicStream::baseUrl();
    }
    else {
        $base_url = $GLOBALS['base_url'] . '/' . $path;
    }
    return $base_url;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.