You are here

protected function ConfigProviderBase::getProfileStorages in Configuration Provider 8.2

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.

This is based on the ConfigInstaller::getProfileStorages(). Contrary to the core method, here we don't use an argument for the extension being installed, since our usage isn't in the context of extension installation.

Return value

\Drupal\Core\Config\StorageInterface[]|null Storages to access configuration from the installation profile.

1 call to ConfigProviderBase::getProfileStorages()
ConfigProviderInstall::addInstallableConfig in src/Plugin/ConfigProvider/ConfigProviderInstall.php
Adds configuration that is available to be installed or updated.

File

src/Plugin/ConfigProviderBase.php, line 151

Class

ConfigProviderBase
Base class for Configuration provider plugins.

Namespace

Drupal\config_provider\Plugin

Code

protected function getProfileStorages() {
  $profile = $this
    ->drupalGetProfile();
  $profile_storages = [];
  if ($profile) {
    $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;
}