You are here

protected function ConfigInstaller::getProfileStorages in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigInstaller.php \Drupal\Core\Config\ConfigInstaller::getProfileStorages()

Gets the profile storage to use to check for profile overrides.

The install profile can override module configuration during a module install. Both the install and optional directories are checked for matching configuration. This allows profiles to override default configuration for modules they do not depend on.

Parameters

string $installing_name: (optional) The name of the extension currently being installed.

Return value

\Drupal\Core\Config\StorageInterface[]|null Storages to access configuration from the installation profile. If we're installing the profile itself, then it will return an empty array as the profile storage should not be used.

2 calls to ConfigInstaller::getProfileStorages()
ConfigInstaller::checkConfigurationToInstall in core/lib/Drupal/Core/Config/ConfigInstaller.php
Checks the configuration that will be installed for an extension.
ConfigInstaller::installDefaultConfig in core/lib/Drupal/Core/Config/ConfigInstaller.php
Installs the default configuration of a given extension.

File

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

Class

ConfigInstaller

Namespace

Drupal\Core\Config

Code

protected function getProfileStorages($installing_name = '') {
  $profile = $this
    ->drupalGetProfile();
  $profile_storages = [];
  if ($profile && $profile != $installing_name) {
    $profile_path = $this
      ->drupalGetPath('module', $profile);
    foreach ([
      InstallStorage::CONFIG_INSTALL_DIRECTORY,
      InstallStorage::CONFIG_OPTIONAL_DIRECTORY,
    ] as $directory) {
      if (is_dir($profile_path . '/' . $directory)) {
        $profile_storages[] = new FileStorage($profile_path . '/' . $directory, StorageInterface::DEFAULT_COLLECTION);
      }
    }
  }
  return $profile_storages;
}