You are here

public function MemoryStorage::rename in Drupal 10

Same name in this branch
  1. 10 core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::rename()
  2. 10 core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php \Drupal\Core\KeyValueStore\MemoryStorage::rename()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::rename()
  2. 9 core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::rename()

Renames a configuration object in the storage.

Parameters

string $name: The name of a configuration object to rename.

string $new_name: The new name of a configuration object.

Return value

bool TRUE on success, FALSE otherwise.

Overrides StorageInterface::rename

File

core/lib/Drupal/Core/Config/MemoryStorage.php, line 87

Class

MemoryStorage
Provides an in memory configuration storage.

Namespace

Drupal\Core\Config

Code

public function rename($name, $new_name) {
  if (!$this
    ->exists($name)) {
    return FALSE;
  }
  $this->config[$this->collection][$new_name] = $this->config[$this->collection][$name];
  unset($this->config[$this->collection][$name]);
  return TRUE;
}