class FileStorageFactory

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Config/FileStorageFactory.php \Drupal\Core\Config\FileStorageFactory
  2. 10 core/lib/Drupal/Core/Config/FileStorageFactory.php \Drupal\Core\Config\FileStorageFactory
  3. 9 core/lib/Drupal/Core/Config/FileStorageFactory.php \Drupal\Core\Config\FileStorageFactory
  4. 8.9.x core/lib/Drupal/Core/Config/FileStorageFactory.php \Drupal\Core\Config\FileStorageFactory

Provides a factory for creating config storage objects.

Hierarchy

Expanded class hierarchy of FileStorageFactory

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use the "config.storage.sync" service instead.

See also

https://www.drupal.org/node/3586484

1 file declares its use of FileStorageFactory
FileStorageFactoryTest.php in core/tests/Drupal/KernelTests/Core/Config/FileStorageFactoryTest.php

File

core/lib/Drupal/Core/Config/FileStorageFactory.php, line 15

Namespace

Drupal\Core\Config
View source
class FileStorageFactory {
  public function __construct() {
    @trigger_error(__CLASS__ . ' is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use the "config.storage.sync" service instead. See https://www.drupal.org/node/3586484', E_USER_DEPRECATED);
  }
  
  /**
   * Returns a StorageInterface object working with the sync config directory.
   *
   * @return \Drupal\Core\Config\StorageInterface
   *   The config storage object for the configuration sync directory.
   *
   * @throws \Drupal\Core\Config\ConfigDirectoryNotDefinedException
   *   In case the sync directory does not exist or is not defined in
   *   $settings['config_sync_directory'].
   */
  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"]');
    }
    @trigger_error(__CLASS__ . '::getSync() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use the "config.storage.sync" service instead. See https://www.drupal.org/node/3586484', E_USER_DEPRECATED);
    return \Drupal::service('config.storage.sync');
  }

}

Members

Title Sort descending Modifiers Object type Summary
FileStorageFactory::getSync public static function Returns a StorageInterface object working with the sync config directory.
FileStorageFactory::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.