You are here

public static function BlockedUsers::supportsIndex in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  2. 8.2 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  3. 8.3 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  4. 8.4 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  5. 8.5 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  6. 8.6 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  7. 8.7 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  8. 8.8 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  9. 10.3.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  10. 10.0.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  11. 10.1.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()
  12. 10.2.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::supportsIndex()

Checks whether this processor is applicable for a certain index.

This can be used for hiding the processor on the index's "Filters" tab. To avoid confusion, you should only use criteria that are more or less constant, such as the index's datasources. Also, since this is only used for UI purposes, you should not completely rely on this to ensure certain index configurations and at least throw an exception with a descriptive error message if this is violated on runtime.

Parameters

\Drupal\search_api\IndexInterface $index: The index to check for.

Return value

bool TRUE if the processor can run on the given index; FALSE otherwise.

Overrides ProcessorPluginBase::supportsIndex

File

modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php, line 32

Class

BlockedUsers
Ignores blocked users in index and queries.

Namespace

Drupal\social_search\Plugin\search_api\processor

Code

public static function supportsIndex(IndexInterface $index) {
  $entity_types = [
    'profile',
  ];
  foreach ($index
    ->getDatasources() as $datasource) {
    if (in_array($datasource
      ->getEntityTypeId(), $entity_types)) {
      return TRUE;
    }
  }
  return FALSE;
}