/**
  * Gets the configuration storage that provides the active configuration.
  *
  * @param string $collection
  *   (optional) The configuration collection. Defaults to the default
  *   collection.
  *
  * @return \Drupal\Core\Config\StorageInterface
  *   The configuration storage that provides the default configuration.
  */
 protected function getActiveStorage($collection = StorageInterface::DEFAULT_COLLECTION)
 {
     if ($this->activeStorage->getCollectionName() != $collection) {
         $this->activeStorage = $this->activeStorage->createCollection($collection);
     }
     return $this->activeStorage;
 }
 /**
  * Returns a cache ID prefix to use for the collection.
  *
  * @return string
  *   The cache ID prefix.
  */
 protected function getCollectionPrefix()
 {
     $collection = $this->storage->getCollectionName();
     if ($collection == StorageInterface::DEFAULT_COLLECTION) {
         return '';
     }
     return $collection . ':';
 }
Exemple #3
0
 /**
  * Gets configuration data from the provided storage to create.
  *
  * @param StorageInterface $storage
  *   The configuration storage to read configuration from.
  * @param string $collection
  *  The configuration collection to use.
  * @param string $prefix
  *   (optional) Limit to configuration starting with the provided string.
  *
  * @return array
  *   An array of configuration data read from the source storage keyed by the
  *   configuration object name.
  */
 protected function getConfigToCreate(StorageInterface $storage, $collection, $prefix = '', StorageInterface $profile_storage = NULL)
 {
     if ($storage->getCollectionName() != $collection) {
         $storage = $storage->createCollection($collection);
     }
     $data = $storage->readMultiple($storage->listAll($prefix));
     // Check to see if the corresponding override storage has any overrides.
     if ($profile_storage) {
         if ($profile_storage->getCollectionName() != $collection) {
             $profile_storage = $profile_storage->createCollection($collection);
         }
         $data = $profile_storage->readMultiple(array_keys($data)) + $data;
     }
     return $data;
 }
 /**
  * {@inheritdoc}
  */
 public function getCollectionName()
 {
     return $this->baseStorage->getCollectionName();
 }