You are here

function config_get_config_directory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/bootstrap.inc \config_get_config_directory()

Returns the path of a configuration directory.

Configuration directories are configured using $config_directories in settings.php.

Parameters

string $type: The type of config directory to return. Drupal core provides the CONFIG_SYNC_DIRECTORY constant to access the sync directory.

Return value

string The configuration directory path.

Throws

\Exception

10 calls to config_get_config_directory()
BootstrapConfigStorageFactory::getFileStorage in core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php
Returns a File-based configuration storage implementation.
ConfigImporterTest::testConfigGetConfigDirectory in core/modules/config/src/Tests/ConfigImporterTest.php
Tests config_get_config_directory().
ConfigImportForm::submitForm in core/modules/config/src/Form/ConfigImportForm.php
Form submission handler.
drupal_install_config_directories in core/includes/install.inc
Creates the config directory and ensures it is operational.
FileStorageFactory::getActive in core/lib/Drupal/Core/Config/FileStorageFactory.php
Returns a FileStorage object working with the active config directory.

... See full list

File

core/includes/bootstrap.inc, line 143
Functions that need to be loaded on every Drupal request.

Code

function config_get_config_directory($type) {
  global $config_directories;

  // @todo Remove fallback in Drupal 9. https://www.drupal.org/node/2574943
  if ($type == CONFIG_SYNC_DIRECTORY && !isset($config_directories[CONFIG_SYNC_DIRECTORY]) && isset($config_directories[CONFIG_STAGING_DIRECTORY])) {
    $type = CONFIG_STAGING_DIRECTORY;
  }
  if (!empty($config_directories[$type])) {
    return $config_directories[$type];
  }
  throw new \Exception("The configuration directory type '{$type}' does not exist");
}