BootstrapConfigStorageFactory.php 836 Bytes
Newer Older
1
2
3
4
5
6
7
8
<?php

/**
 * @file
 * Contains Drupal\Core\Config\BootstrapConfigStorageFactory.
 */

namespace Drupal\Core\Config;
9

10
use Drupal\Component\Utility\Settings;
11
12
13
14
15
16
17
18
19
20
21
22
23

/**
 * Defines a factory for retrieving the config storage used pre-kernel.
 */
class BootstrapConfigStorageFactory {

  /**
   * Returns a configuration storage implementation.
   *
   * @return \Drupal\Core\Config\StorageInterface
   *   A configuration storage implementation.
   */
  public static function get() {
24
    $drupal_bootstrap_config_storage = Settings::get('drupal_bootstrap_config_storage');
25
26
    if ($drupal_bootstrap_config_storage && is_callable($drupal_bootstrap_config_storage)) {
      return call_user_func($drupal_bootstrap_config_storage);
27
28
29
30
31
32
33
    }
    else {
      return new FileStorage(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
    }
  }

}