You are here

protected function ConfigFactory::doLoadMultiple in Domain Access 8

Returns a list of configuration objects for the given names.

Parameters

array $names: List of names of configuration objects.

bool $immutable: (optional) Create an immutable configuration objects. Defaults to TRUE.

Return value

\Drupal\Core\Config\Config[]|\Drupal\Core\Config\ImmutableConfig[] List of successfully loaded configuration objects, keyed by name.

Overrides ConfigFactory::doLoadMultiple

1 call to ConfigFactory::doLoadMultiple()
ConfigFactory::doGet in domain_config_ui/src/Config/ConfigFactory.php
Returns a configuration object for a given name.

File

domain_config_ui/src/Config/ConfigFactory.php, line 66

Class

ConfigFactory
Extends core ConfigFactory class to save domain specific configuration.

Namespace

Drupal\domain_config_ui\Config

Code

protected function doLoadMultiple(array $names, $immutable = TRUE) {

  // Let parent load multiple load as usual.
  $list = parent::doLoadMultiple($names, $immutable);

  // Do not override if configuring 'all' domains or config is immutable.
  // @TODO: This will need to change if we allow saving for 'all allowed domains'
  if (empty($this->domainConfigUIManager) || !$this->domainConfigUIManager
    ->getSelectedDomainId()) {
    return $list;
  }

  // Pre-load remaining configuration files.
  if (!empty($names)) {

    // Initialise override information.
    $module_overrides = [];
    $storage_data = $this->storage
      ->readMultiple($names);

    // Load module overrides so that domain config is loaded in admin forms.
    if (!empty($storage_data)) {

      // Only get domain overrides if we have configuration to override.
      $module_overrides = $this
        ->loadDomainOverrides($names);
    }
    foreach ($storage_data as $name => $data) {
      $cache_key = $this
        ->getConfigCacheKey($name, $immutable);
      if (!empty($module_overrides[$name])) {
        $this->cache[$cache_key]
          ->setModuleOverride($module_overrides[$name]);
        $list[$name] = $this->cache[$cache_key];
        $this
          ->propagateConfigOverrideCacheability($cache_key, $name);
      }
    }
  }
  return $list;
}