public static function Settings::get in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
- 9 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.
75 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.
File
- core/
lib/ Drupal/ Core/ Site/ Settings.php, line 99
Class
- Settings
- Read only settings that are initialized with the class.
Namespace
Drupal\Core\SiteCode
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;
}