You are here

public function LingotekFakeConfigFactory::getEditable in Lingotek Translation 3.4.x

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

Returns a mutable configuration object for a given name.

Should not be used for config that will have runtime effects. Therefore it is always loaded override free.

Parameters

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

Return value

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

Overrides ConfigFactory::getEditable

File

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

Class

LingotekFakeConfigFactory

Namespace

Drupal\lingotek_test

Code

public function getEditable($name) {
  $config = parent::getEditable($name);
  if ($name === 'lingotek.settings') {
    if ($config instanceof LingotekFakeConfigWrapper && $config->config instanceof ImmutableConfig) {
      unset($this->cache[$name]);
      $config = parent::getEditable($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;
}