class BootstrapConfigStorageFactory

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php \Drupal\Core\Config\BootstrapConfigStorageFactory
  2. 10 core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php \Drupal\Core\Config\BootstrapConfigStorageFactory
  3. 11.x core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php \Drupal\Core\Config\BootstrapConfigStorageFactory

Defines a factory for retrieving the config storage used pre-kernel.

Hierarchy

Expanded class hierarchy of BootstrapConfigStorageFactory

4 files declare their use of BootstrapConfigStorageFactory
bootstrap.inc in core/includes/bootstrap.inc
Functions that need to be loaded on every Drupal request.
DrupalKernel.php in core/lib/Drupal/Core/DrupalKernel.php
LanguageServiceProvider.php in core/modules/language/src/LanguageServiceProvider.php
RegisterSerializationClassesCompilerPass.php in core/modules/serialization/src/RegisterSerializationClassesCompilerPass.php

File

core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php, line 11

Namespace

Drupal\Core\Config
View source
class BootstrapConfigStorageFactory {
    
    /**
     * Returns a configuration storage implementation.
     *
     * @param $class_loader
     *   The class loader. Normally Composer's ClassLoader, as included by the
     *   front controller, but may also be decorated; e.g.,
     *   \Symfony\Component\ClassLoader\ApcClassLoader.
     *
     * @return \Drupal\Core\Config\StorageInterface
     *   A configuration storage implementation.
     */
    public static function get($class_loader = NULL) {
        $bootstrap_config_storage = Settings::get('bootstrap_config_storage');
        $storage_backend = FALSE;
        if (!empty($bootstrap_config_storage) && is_callable($bootstrap_config_storage)) {
            $storage_backend = call_user_func($bootstrap_config_storage, $class_loader);
        }
        // Fallback to the DatabaseStorage.
        return $storage_backend ?: self::getDatabaseStorage();
    }
    
    /**
     * Returns a Database configuration storage implementation.
     *
     * @return \Drupal\Core\Config\DatabaseStorage
     */
    public static function getDatabaseStorage() {
        return new DatabaseStorage(Database::getConnection(), 'config');
    }
    
    /**
     * Returns a File-based configuration storage implementation.
     *
     * If there is no active configuration directory calling this method will
     * result in an error.
     *
     * @return \Drupal\Core\Config\FileStorage
     *
     * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Drupal core
     * no longer creates an active directory.
     *
     * @throws \Exception
     */
    public static function getFileStorage() {
        return new FileStorage(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary
BootstrapConfigStorageFactory::get public static function Returns a configuration storage implementation.
BootstrapConfigStorageFactory::getDatabaseStorage public static function Returns a Database configuration storage implementation.
BootstrapConfigStorageFactory::getFileStorage Deprecated public static function Returns a File-based configuration storage implementation.

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