function ConfigConfigurator::getConfigStorage
Same name in other branches
- 11.x core/lib/Drupal/Core/Recipe/ConfigConfigurator.php \Drupal\Core\Recipe\ConfigConfigurator::getConfigStorage()
Gets a config storage object for reading config from the recipe.
Return value
\Drupal\Core\Config\StorageInterface The config storage object for reading config from the recipe.
1 call to ConfigConfigurator::getConfigStorage()
- ConfigConfigurator::__construct in core/
lib/ Drupal/ Core/ Recipe/ ConfigConfigurator.php
File
-
core/
lib/ Drupal/ Core/ Recipe/ ConfigConfigurator.php, line 80
Class
- ConfigConfigurator
- @internal This API is experimental.
Namespace
Drupal\Core\RecipeCode
public function getConfigStorage() : StorageInterface {
$storages = [];
if ($this->recipeConfigDirectory) {
// Config provided by the recipe should take priority over config from
// extensions.
$storages[] = new FileStorage($this->recipeConfigDirectory);
}
if (!empty($this->config['import'])) {
/** @var \Drupal\Core\Extension\ModuleExtensionList $module_list */
$module_list = \Drupal::service('extension.list.module');
/** @var \Drupal\Core\Extension\ThemeExtensionList $theme_list */
$theme_list = \Drupal::service('extension.list.theme');
foreach ($this->config['import'] as $extension => $config) {
// If the recipe explicitly does not want to import any config from this
// extension, skip it.
if ($config === NULL) {
continue;
}
$path = match (TRUE) { $module_list->exists($extension) => $module_list->getPath($extension),
$theme_list->exists($extension) => $theme_list->getPath($extension),
default => throw new \RuntimeException("{$extension} is not a theme or module"),
};
$config = $config === '*' ? [] : $config;
$storages[] = new RecipeExtensionConfigStorage($path, $config);
}
}
return RecipeConfigStorageWrapper::createStorageFromArray($storages);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.