Renames a configuration object using the storage controller.
string $old_name: The old name of the configuration object.
string $new_name: The new name of the configuration object.
\Drupal\Core\Config\Config The renamed config object.
public function rename($old_name, $new_name) {
$context = $this
->getContext();
$old_cache_key = $this
->getCacheKey($old_name, $context);
$new_cache_key = $this
->getCacheKey($new_name, $context);
if (isset($this->cache[$old_cache_key])) {
$config = $this->cache[$old_cache_key];
unset($this->cache[$old_cache_key]);
}
else {
// Create the config object if it's not yet loaded into the static cache.
$config = new Config($old_name, $this->storage, $context);
}
$this->cache[$new_cache_key] = $config;
$this->storage
->rename($old_name, $new_name);
return $this->cache[$new_cache_key]
->setName($new_name)
->init();
}