1.20.x config.inc | config_get_config_storage($type = 'active') |
Get the storage object for the specified configuration type
Parameters
string $type: (optional) The type of config directory to return. Backdrop core provides 'active' and 'staging'. Defaults to 'active'.
Return value
ConfigStorageInterface: A ConfigStorageInterface object managing the specified configuration type.
File
- includes/
config.inc, line 365 - This is the API for configuration storage.
Code
function config_get_config_storage($type = 'active') {
static $stores = array();
$directory = config_get_config_directory($type);
if (!array_key_exists($directory, $stores)) {
$handlers = config_get_config_storage_handlers();
$colon_pos = strpos($directory, ':');
if ($colon_pos !== FALSE) {
$storage_type = substr($directory, 0, $colon_pos);
foreach ($handlers[$storage_type] as $class) {
$object = new $class($directory);
if (is_object($object)) {
$stores[$directory] = $object;
break;
}
}
}
else {
$stores[$directory] = new ConfigFileStorage($directory);
}
}
return $stores[$directory];
}