1 config.inc | public Config::getOriginal($key = '') |
Gets the current config value as specified in the written config storage.
In most cases, Config::get() should be used to pull the config value and also include any overrides to apply. This method should be used only when explicitly wanting the currently saved value (as stored in a config file) rather than what may be specified in an override (as provided in settings.php).
Parameters
string $key: The string that maps to a key with the configuration data. See Config::get() for full examples.
Return value
mixed: The data that was requested.
See also
File
- core/
includes/ config.inc, line 680 - This is the API for configuration storage.
Class
- Config
- Defines the default configuration object.
Code
public function getOriginal($key = '') {
if (!$this->isLoaded) {
$this->load();
}
if (empty($key)) {
return $this->data;
}
else {
$parts = explode('.', $key);
if (count($parts) == 1) {
return isset($this->data[$key]) ? $this->data[$key] : NULL;
}
else {
$value = $this->data;
$key_exists = FALSE;
foreach ($parts as $part) {
if (is_array($value) && array_key_exists($part, $value)) {
$value = $value[$part];
$key_exists = TRUE;
}
else {
$key_exists = FALSE;
break;
}
}
return $key_exists ? $value : NULL;
}
}
}