You are here

public function LingotekFakeConfigFactory::get in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 4.0.x tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php \Drupal\lingotek_test\LingotekFakeConfigFactory::get()
  2. 3.3.x tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php \Drupal\lingotek_test\LingotekFakeConfigFactory::get()
  3. 3.4.x tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php \Drupal\lingotek_test\LingotekFakeConfigFactory::get()
  4. 3.5.x tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php \Drupal\lingotek_test\LingotekFakeConfigFactory::get()
  5. 3.7.x tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php \Drupal\lingotek_test\LingotekFakeConfigFactory::get()
  6. 3.8.x tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php \Drupal\lingotek_test\LingotekFakeConfigFactory::get()

Returns an immutable configuration object for a given name.

Parameters

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

Return value

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

Overrides ConfigFactory::get

File

tests/modules/lingotek_test/src/LingotekFakeConfigFactory.php, line 11

Class

LingotekFakeConfigFactory

Namespace

Drupal\lingotek_test

Code

public function get($name) {
  $config = parent::get($name);
  if ($name === 'lingotek.settings') {
    if ($config instanceof LingotekFakeConfigWrapper && !$config->config instanceof ImmutableConfig) {
      unset($this->cache[$name]);
      $config = parent::get($name);
      $config = new LingotekFakeConfigWrapper($name, $this->storage, $this->eventDispatcher, $this->typedConfigManager, $config);
      $this->cache[$name] = $config;
    }
    elseif (!$config instanceof LingotekFakeConfigWrapper) {
      $config = new LingotekFakeConfigWrapper($name, $this->storage, $this->eventDispatcher, $this->typedConfigManager, $config);
      $this->cache[$name] = $config;
    }
  }
  return $config;
}