function Settings::get

Same name in other branches
  1. 9 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
  2. 10 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
  3. 11.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()

Returns a setting.

Settings can be set in settings.php in the $settings array and requested by this function. Settings should be used over configuration for read-only, possibly low bootstrap configuration that is environment specific.

Parameters

string $name: The name of the setting to return.

mixed $default: (optional) The default value to use if this setting is not set.

Return value

mixed The value of the setting, the provided default if not set.

94 calls to Settings::get()
authorize_access_allowed in core/authorize.php
Determines if the current user is allowed to run authorize.php.
BootstrapConfigStorageFactory::get in core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php
Returns a configuration storage implementation.
ClientFactory::fromOptions in core/lib/Drupal/Core/Http/ClientFactory.php
Constructs a new client object from some configuration.
ConfigFileContentTest::testSerialization in core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php
Tests serialization of configuration to file.
ConfigImportUploadTest::testImport in core/modules/config/tests/src/Functional/ConfigImportUploadTest.php
Tests importing configuration.

... See full list

File

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

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function get($name, $default = NULL) {
    if ($name === 'install_profile' && isset(self::$instance->storage[$name])) {
        @trigger_error('To access the install profile in Drupal 8 use \\Drupal::installProfile() or inject the install_profile container parameter into your service. See https://www.drupal.org/node/2538996', E_USER_DEPRECATED);
    }
    return isset(self::$instance->storage[$name]) ? self::$instance->storage[$name] : $default;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.