You are here

public function SiteConfigOverrides::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/SiteConfigOverrides.php, line 47

Class

SiteConfigOverrides

Namespace

Drupal\config_override

Code

public function loadOverrides($names) {
  $overrides = [];
  if (!($directory = $this
    ->getSiteConfigOverrideFolder())) {
    return $overrides;
  }
  if ($config = $this->cacheBackend
    ->get('config_overrides.site')) {
    $overrides = $config->data;
  }
  else {
    $storage = new FileStorage($this
      ->getSiteConfigOverrideFolder());
    $overrides = $storage
      ->readMultiple($storage
      ->listAll());
    $this->cacheBackend
      ->set('config_overrides.site', $overrides);
  }
  return array_intersect_key($overrides, array_flip($names));
}