You are here

function search_api_config_import_steps_alter in Search API 8

Implements hook_config_import_steps_alter().

File

./search_api.module, line 178
Provides a rich framework for creating searches.

Code

function search_api_config_import_steps_alter(&$sync_steps, ConfigImporter $config_importer) {
  $new = $config_importer
    ->getUnprocessedConfiguration('create');
  $changed = $config_importer
    ->getUnprocessedConfiguration('update');
  $new_or_changed = array_merge($new, $changed);
  $prefix = \Drupal::entityTypeManager()
    ->getDefinition('search_api_index')
    ->getConfigPrefix() . '.';
  $prefix_length = strlen($prefix);
  foreach ($new_or_changed as $config_id) {
    if (substr($config_id, 0, $prefix_length) === $prefix) {
      $sync_steps[] = [
        'Drupal\\search_api\\Task\\IndexTaskManager',
        'processIndexTasks',
      ];
    }
  }
}