public function ModuleConfigOverrides::loadOverrides in Config override 8
Returns config overrides.
Parameters
array $names: A list of configuration names that are being loaded.
Return value
array An array keyed by configuration name of override data. Override data contains a nested array structure of overrides.
Overrides ConfigFactoryOverrideInterface::loadOverrides
File
- src/
ModuleConfigOverrides.php, line 53 - Contains \Drupal\config_override\ModuleConfigOverrides.
Class
Namespace
Drupal\config_overrideCode
public function loadOverrides($names) {
$overrides = [];
if ($config = $this->cacheBackend
->get('config_overrides.modules')) {
$overrides = $config->data;
}
else {
$modules = $this->moduleHandler
->getModuleList();
foreach ($modules as $module) {
$folder = $this->root . '/' . $module
->getPath() . '/config/override';
if (file_exists($folder)) {
$file_storage = new FileStorage($folder);
$overrides = NestedArray::mergeDeep($overrides, $file_storage
->readMultiple($file_storage
->listAll()));
}
}
$this->cacheBackend
->set('config_overrides.modules', $overrides);
}
return array_intersect_key($overrides, array_flip($names));
}