W3cubDocs

/Drupal 8

protected function ConfigInstaller::getConfigToCreate

protected ConfigInstaller::getConfigToCreate(StorageInterface $storage, $collection, $prefix = '', array $profile_storages = [])

Gets configuration data from the provided storage to create.

Parameters

StorageInterface $storage: The configuration storage to read configuration from.

string $collection: The configuration collection to use.

string $prefix: (optional) Limit to configuration starting with the provided string.

\Drupal\Core\Config\StorageInterface[] $profile_storages: An array of storage interfaces containing profile configuration to check for overrides.

Return value

array An array of configuration data read from the source storage keyed by the configuration object name.

File

core/lib/Drupal/Core/Config/ConfigInstaller.php, line 241

Class

ConfigInstaller

Namespace

Drupal\Core\Config

Code

protected function getConfigToCreate(StorageInterface $storage, $collection, $prefix = '', array $profile_storages = []) {
  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.
  foreach ($profile_storages as $profile_storage) {
    if ($profile_storage->getCollectionName() != $collection) {
      $profile_storage = $profile_storage->createCollection($collection);
    }
    $data = $profile_storage->readMultiple(array_keys($data)) + $data;
  }
  return $data;
}

© 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!ConfigInstaller.php/function/ConfigInstaller::getConfigToCreate/8.1.x