function StorageComparer::getTargetStorage

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::getTargetStorage()
  2. 8.9.x core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::getTargetStorage()
  3. 11.x core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::getTargetStorage()

Overrides StorageComparerInterface::getTargetStorage

1 call to StorageComparer::getTargetStorage()
StorageComparer::getAndSortConfigData in core/lib/Drupal/Core/Config/StorageComparer.php
Gets and sorts configuration data from the source and target storages.

File

core/lib/Drupal/Core/Config/StorageComparer.php, line 158

Class

StorageComparer
Defines a config storage comparer.

Namespace

Drupal\Core\Config

Code

public function getTargetStorage($collection = StorageInterface::DEFAULT_COLLECTION) {
    if (!isset($this->targetStorages[$collection])) {
        $target = $this->targetStorage;
        if ($collection !== StorageInterface::DEFAULT_COLLECTION) {
            $target = $target->createCollection($collection);
        }
        // If we are not in write mode wrap the storage in a static cache so that
        // multiple reads of the same configuration object are cheap.
        if (!$this->writeMode) {
            $target = new CachedStorage($target, $this->targetCacheStorage);
        }
        $this->targetStorages[$collection] = $target;
    }
    return $this->targetStorages[$collection];
}

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