function CheckpointStorage::storeCollectionName

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php \Drupal\Core\Config\Checkpoint\CheckpointStorage::storeCollectionName()

Stores the collection name so the storage knows its own collections.

Parameters

string $collection: The name of the collection.

2 calls to CheckpointStorage::storeCollectionName()
CheckpointStorage::onConfigRename in core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php
Updates checkpoint when configuration is saved.
CheckpointStorage::onConfigSaveAndDelete in core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php
Updates checkpoint when configuration is saved.

File

core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php, line 437

Class

CheckpointStorage
Provides a config storage that can make checkpoints.

Namespace

Drupal\Core\Config\Checkpoint

Code

private function storeCollectionName(string $collection) : void {
    // We do not need to store the default collection.
    if ($collection === StorageInterface::DEFAULT_COLLECTION) {
        return;
    }
    $key_value = $this->getKeyValue($this->checkpoints
        ->getActiveCheckpoint()->id, StorageInterface::DEFAULT_COLLECTION);
    $collections = $key_value->get(static::CONFIG_COLLECTION_KEY, []);
    assert(is_array($collections));
    if (in_array($collection, $collections, TRUE)) {
        return;
    }
    $collections[] = $collection;
    $key_value->set(static::CONFIG_COLLECTION_KEY, $collections);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.