You are here

public function DecoratingConfigInstaller::installOptionalConfig in Configuration selector 8.2

Same name and namespace in other branches
  1. 8 src/DecoratingConfigInstaller.php \Drupal\config_selector\DecoratingConfigInstaller::installOptionalConfig()

Installs optional configuration.

Optional configuration is only installed if:

  • the configuration does not exist already.
  • it's a configuration entity.
  • its dependencies can be met.

Parameters

\Drupal\Core\Config\StorageInterface $storage: (optional) The configuration storage to search for optional configuration. If not provided, all enabled extension's optional configuration directories including the install profile's will be searched.

array $dependency: (optional) If set, ensures that the configuration being installed has this dependency. The format is dependency type as the key ('module', 'theme', or 'config') and the dependency name as the value ('book', 'bartik', 'views.view.frontpage').

Overrides ConfigInstallerInterface::installOptionalConfig

File

src/DecoratingConfigInstaller.php, line 47

Class

DecoratingConfigInstaller
Decorates the config.installer service so install_install_profiles() works.

Namespace

Drupal\config_selector

Code

public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []) {
  $this->decoratedService
    ->installOptionalConfig($storage, $dependency);
  if ($storage === NULL && empty($dependency)) {

    // This is not called as part of a regular module install. It's called
    // install_install_profile(). This means that
    // \Drupal\config_selector\ConfigSelector::$modulePreinstallTriggered will
    // be NULL and therefore this will proceed to check all the configuration.
    $this->configSelector
      ->selectConfigOnInstall([]);
  }
}