W3cubDocs

/Drupal 8

public static function Settings::get

public static Settings::get($name, $default = NULL)

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.

File

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

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function get($name, $default = NULL) {
  return isset(self::$instance->storage[$name]) ? self::$instance->storage[$name] : $default;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Site!Settings.php/function/Settings::get/8.1.x