You are here

protected function ConfigFactory::doGet in Domain Access 8

Returns a configuration object for a given name.

Parameters

string $name: The name of the configuration object to construct.

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

Return value

\Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig A configuration object.

Overrides ConfigFactory::doGet

File

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

Class

ConfigFactory
Extends core ConfigFactory class to save domain specific configuration.

Namespace

Drupal\domain_config_ui\Config

Code

protected function doGet($name, $immutable = TRUE) {

  // If config for 'all' domains or immutable then don't override config.
  if (empty($this->domainConfigUIManager) || !$this->domainConfigUIManager
    ->getSelectedDomainId()) {
    return parent::doGet($name, $immutable);
  }
  if ($config = $this
    ->doLoadMultiple([
    $name,
  ], $immutable)) {
    return $config[$name];
  }
  else {

    // If the configuration object does not exist in the configuration
    // storage, create a new object.
    $config = $this
      ->createConfigObject($name, $immutable);

    // Load domain overrides so domain config is loaded in admin forms.
    $overrides = $this
      ->loadDomainOverrides([
      $name,
    ]);
    if (isset($overrides[$name])) {
      $config
        ->setModuleOverride($overrides[$name]);
    }
    foreach ($this->configFactoryOverrides as $override) {
      $config
        ->addCacheableDependency($override
        ->getCacheableMetadata($name));
    }
    return $config;
  }
}