PublicStream::baseUrl

public static PublicStream::baseUrl()

Finds and returns the base URL for public://.

Defaults to the current site's base URL plus directory path.

Note that this static method is used by \Drupal\system\Form\FileSystemForm so you should alter that form or substitute a different form if you change the class providing the stream_wrapper.public service.

Return value

string The external base URL for public://

File

core/lib/Drupal/Core/StreamWrapper/PublicStream.php, line 66

Class

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

Namespace

Drupal\Core\StreamWrapper

Code

public static function baseUrl() {
  $settings_base_url = Settings::get('file_public_base_url', '');
  if ($settings_base_url) {
    return (string) $settings_base_url;
  }
  else {
    return $GLOBALS['base_url'] . '/' . static::basePath();
  }
}
doc_Drupal
2016-10-29 09:35:12
Comments
Leave a Comment

Please login to continue.