You are here

public static function FileStorageFactory::getSync in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/FileStorageFactory.php \Drupal\Core\Config\FileStorageFactory::getSync()
  2. 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

\Drupal\Core\Config\ConfigDirectoryNotDefinedException 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 21

Class

FileStorageFactory
Provides a factory for creating config file storage objects.

Namespace

Drupal\Core\Config

Code

public static function getSync() {
  $directory = Settings::get('config_sync_directory', FALSE);
  if ($directory === FALSE) {
    throw new ConfigDirectoryNotDefinedException('The config sync directory is not defined in $settings["config_sync_directory"]');
  }
  return new FileStorage($directory);
}