public function StorageComparer::getTargetStorage

public StorageComparer::getTargetStorage($collection = StorageInterface::DEFAULT_COLLECTION)

Gets the configuration target storage.

Parameters

string $collection: (optional) The storage collection to use. Defaults to the default collection.

Return value

\Drupal\Core\Config\StorageInterface Storage object used to write configuration.

Overrides StorageComparerInterface::getTargetStorage

File

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

Class

StorageComparer
Defines a config storage comparer.

Namespace

Drupal\Core\Config

Code

public function getTargetStorage($collection = StorageInterface::DEFAULT_COLLECTION) {
  if (!isset($this->targetStorages[$collection])) {
    if ($collection == StorageInterface::DEFAULT_COLLECTION) {
      $this->targetStorages[$collection] = $this->targetStorage;
    }
    else {
      $this->targetStorages[$collection] = $this->targetStorage->createCollection($collection);
    }
  }
  return $this->targetStorages[$collection];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!StorageComparer.php/function/StorageComparer::getTargetStorage/8.1.x