public static function 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();
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!StreamWrapper!PublicStream.php/function/PublicStream::baseUrl/8.1.x