function Settings::get

Same name in other branches
  1. 8.9.x 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.

78 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 120

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function get($name, $default = NULL) {
    // If the caller is asking for the value of a deprecated setting, trigger a
    // deprecation message about it.
    if (isset(self::$deprecatedSettings[$name])) {
        @trigger_error(self::$deprecatedSettings[$name]['message'], E_USER_DEPRECATED);
    }
    return self::$instance->storage[$name] ?? $default;
}

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