function CheckpointStorage::onConfigRename
Same name in other branches
- 10 core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php \Drupal\Core\Config\Checkpoint\CheckpointStorage::onConfigRename()
Updates checkpoint when configuration is saved.
Parameters
\Drupal\Core\Config\ConfigRenameEvent $event: The configuration event.
File
-
core/
lib/ Drupal/ Core/ Config/ Checkpoint/ CheckpointStorage.php, line 388
Class
- CheckpointStorage
- Provides a config storage that can make checkpoints.
Namespace
Drupal\Core\Config\CheckpointCode
public function onConfigRename(ConfigRenameEvent $event) : void {
$active_checkpoint = $this->checkpoints
->getActiveCheckpoint();
if ($active_checkpoint === NULL) {
return;
}
$collection = $event->getConfig()
->getStorage()
->getCollectionName();
$this->storeCollectionName($collection);
$key_value = $this->getKeyValue($active_checkpoint->id, $collection);
$old_name = $event->getOldName();
// If we have not yet stored a checkpoint for this configuration, store a
// complete copy of the original configuration. Note that renames do not
// change data but storing the complete data allows
// \Drupal\Core\Config\ConfigImporter to track renames using UUIDs.
if ($key_value->get($old_name) === NULL) {
$key_value->set($old_name, $this->getOriginalConfig($event->getConfig()));
}
// Record that the new name did not exist prior to the checkpoint.
$new_name = $event->getConfig()
->getName();
if ($key_value->get($new_name) === NULL) {
$key_value->set($new_name, FALSE);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.