function Settings::getInstance
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::getInstance()
- 10 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::getInstance()
- 11.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::getInstance()
Returns the settings instance.
A singleton is used because this class is used before the container is available.
Return value
Throws
\BadMethodCallException Thrown when the settings instance has not been initialized yet.
8 calls to Settings::getInstance()
- ConfigEntityUpdaterTest::testUpdate in core/
tests/ Drupal/ KernelTests/ Core/ Config/ Entity/ ConfigEntityUpdaterTest.php - @covers ::update
- ConfigEntityUpdaterTest::testUpdateDefaultCallback in core/
tests/ Drupal/ KernelTests/ Core/ Config/ Entity/ ConfigEntityUpdaterTest.php - @covers ::update
- DatabaseBackendFactory::__construct in core/
lib/ Drupal/ Core/ Cache/ DatabaseBackendFactory.php - Constructs the DatabaseBackendFactory object.
- FileStorageFactoryTest::testGetSync in core/
tests/ Drupal/ KernelTests/ Core/ Config/ FileStorageFactoryTest.php - @covers ::getSync
- install_begin_request in core/
includes/ install.core.inc - Begins an installation request, modifying the installation state as needed.
1 string reference to 'Settings::getInstance'
- core.services.yml in core/
core.services.yml - core/core.services.yml
File
-
core/
lib/ Drupal/ Core/ Site/ Settings.php, line 85
Class
- Settings
- Read only settings that are initialized with the class.
Namespace
Drupal\Core\SiteCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.