You are here

function search_api_solr_delete_and_reinstall_all_field_types in Search API Solr 8.2

Deletes all Solr Field Type and re-installs them from their yml files.

1 call to search_api_solr_delete_and_reinstall_all_field_types()
CommandHelper::reinstallFieldtypesCommand in src/Utility/CommandHelper.php
Deletes all Solr Field Type and re-installs them from their yml files.

File

./search_api_solr.module, line 411

Code

function search_api_solr_delete_and_reinstall_all_field_types() {
  $storage = \Drupal::entityTypeManager()
    ->getStorage('solr_field_type');
  $storage
    ->delete($storage
    ->loadMultiple());

  /** @var \Drupal\Core\Config\ConfigInstallerInterface $config_installer */
  $config_installer = \Drupal::service('config.installer');
  $config_installer
    ->installDefaultConfig('module', 'search_api_solr');
  $restrict_by_dependency = [
    'module' => 'search_api_solr',
  ];
  $config_installer
    ->installOptionalConfig(NULL, $restrict_by_dependency);
}