Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PublicStream.php

function 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://

3 calls to PublicStream::baseUrl()
AssetsStream::baseUrl in core/lib/Drupal/Core/StreamWrapper/AssetsStream.php
Finds and returns the base URL for public://.
FileSystemForm::buildForm in core/modules/system/src/Form/FileSystemForm.php
Form constructor.
PublicStream::getExternalUrl in core/lib/Drupal/Core/StreamWrapper/PublicStream.php
Returns a web accessible URL for the resource.
1 method overrides PublicStream::baseUrl()
AssetsStream::baseUrl in core/lib/Drupal/Core/StreamWrapper/AssetsStream.php
Finds and returns the 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();
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal