public static function FileStorageFactory::getSync in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Config/FileStorageFactory.php \Drupal\Core\Config\FileStorageFactory::getSync()
Returns a FileStorage object working with the sync config directory.
Return value
\Drupal\Core\Config\FileStorage FileStorage
Throws
\Exception In case the sync directory does not exist or is not defined in $settings['config_sync_directory'].
1 call to FileStorageFactory::getSync()
- FileStorageFactoryTest::testGetSync in core/
tests/ Drupal/ KernelTests/ Core/ Config/ FileStorageFactoryTest.php - @covers ::getSync
1 string reference to 'FileStorageFactory::getSync'
- core.services.yml in core/
core.services.yml - core/core.services.yml
File
- core/
lib/ Drupal/ Core/ Config/ FileStorageFactory.php, line 33
Class
- FileStorageFactory
- Provides a factory for creating config file storage objects.
Namespace
Drupal\Core\ConfigCode
public static function getSync() {
$directory = Settings::get('config_sync_directory', FALSE);
if ($directory === FALSE) {
// @todo: throw a more specific exception.
// @see https://www.drupal.org/node/2696103
throw new \Exception('The config sync directory is not defined in $settings["config_sync_directory"]');
}
return new FileStorage($directory);
}