You are here

public function RestrictedNameProcessor::preIndexSave in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php \Drupal\social_profile_privacy\Plugin\search_api\processor\RestrictedNameProcessor::preIndexSave()
  2. 8.7 modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php \Drupal\social_profile_privacy\Plugin\search_api\processor\RestrictedNameProcessor::preIndexSave()
  3. 10.3.x modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php \Drupal\social_profile_privacy\Plugin\search_api\processor\RestrictedNameProcessor::preIndexSave()
  4. 10.0.x modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php \Drupal\social_profile_privacy\Plugin\search_api\processor\RestrictedNameProcessor::preIndexSave()
  5. 10.1.x modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php \Drupal\social_profile_privacy\Plugin\search_api\processor\RestrictedNameProcessor::preIndexSave()
  6. 10.2.x modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php \Drupal\social_profile_privacy\Plugin\search_api\processor\RestrictedNameProcessor::preIndexSave()

Preprocesses the search index entity before it is saved.

This can, for example, be used to make sure fields needed by this processor are enabled on the index.

Overrides ProcessorPluginBase::preIndexSave

File

modules/social_features/social_profile/modules/social_profile_privacy/src/Plugin/search_api/processor/RestrictedNameProcessor.php, line 73

Class

RestrictedNameProcessor
The RestrictedNameProcessor adds the restricted name to search indexes.

Namespace

Drupal\social_profile_privacy\Plugin\search_api\processor

Code

public function preIndexSave() {
  $datasources = $this
    ->getIndex()
    ->getDatasources();

  // Ensure that we have our "Restricted Name" field for all our supported
  // datasources.
  foreach ($datasources as $datasource_id => $datasource) {
    if ($this
      ->supportsDataSource($datasource)) {
      $this
        ->ensureField($datasource_id, 'social_profile_privacy_restricted_name');
    }
  }
}