You are here

function search_api_solr_update_helper_install_configs in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 search_api_solr.install \search_api_solr_update_helper_install_configs()
  2. 4.x search_api_solr.install \search_api_solr_update_helper_install_configs()

Helper function to install all new configs.

Parameters

string $directory:

1 call to search_api_solr_update_helper_install_configs()
search_api_solr_update_8214 in ./search_api_solr.install
All pre-configured Solr field type configurations will be re-installed as delivered by the module! Please export your existing config before running the update and compare the changes manually, if you modified these configs by yourself!

File

./search_api_solr.install, line 244

Code

function search_api_solr_update_helper_install_configs($directory = InstallStorage::CONFIG_OPTIONAL_DIRECTORY) {

  /** @var \Drupal\Core\Config\ConfigInstallerInterface $config_installer */
  $config_installer = \Drupal::service('config.installer');
  $config_installer
    ->installDefaultConfig('module', 'search_api_solr');
  $optional_install_path = \Drupal::moduleHandler()
    ->getModule('search_api_solr')
    ->getPath() . '/' . $directory;
  if (is_dir($optional_install_path)) {

    // Install any optional config the module provides.
    $storage = new FileStorage($optional_install_path, StorageInterface::DEFAULT_COLLECTION);
    $config_installer
      ->installOptionalConfig($storage);
  }
  $restrict_by_dependency = [
    'module' => 'search_api_solr',
  ];
  $config_installer
    ->installOptionalConfig(NULL, $restrict_by_dependency);
}