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

Breadcrumb

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

function Settings::getInstance

Returns the settings instance.

A singleton is used because this class is used before the container is available.

Return value

\Drupal\Core\Site\Settings

Throws

\BadMethodCallException Thrown when the settings instance has not been initialized yet.

2 calls to Settings::getInstance()
install_begin_request in core/includes/install.core.inc
Begins an installation request, modifying the installation state as needed.
UpdateKernel::handle in core/lib/Drupal/Core/Update/UpdateKernel.php
Handles a Request to convert it to a Response.

File

core/lib/Drupal/Core/Site/Settings.php, line 69

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function getInstance() {
    if (self::$instance === NULL) {
        throw new \BadMethodCallException('Settings::$instance is not initialized yet. Whatever you are trying to do, it might be too early for that. You could call Settings::initialize(), but it is probably better to wait until it is called in the regular way. Also check for recursions.');
    }
    return self::$instance;
}

API Navigation

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