Returns the path of a configuration directory.
string $type: (optional) The type of config directory to return. Drupal core provides 'active' and 'staging'. Defaults to CONFIG_ACTIVE_DIRECTORY.
string The configuration directory path.
function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) {
global $config_directories;
if ($test_prefix = drupal_valid_test_ua()) {
// @see Drupal\simpletest\WebTestBase::setUp()
$path = conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/config_' . $type;
}
elseif (!empty($config_directories[$type])) {
// Allow a configuration directory path to be outside of webroot.
if (empty($config_directories[$type]['absolute'])) {
$path = conf_path() . '/files/' . $config_directories[$type]['path'];
}
else {
$path = $config_directories[$type]['path'];
}
}
else {
throw new Exception(format_string('The configuration directory type %type does not exist.', array(
'%type' => $type,
)));
}
return $path;
}