You are here

public static function SuperUser::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/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  2. 8.2 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  3. 8.3 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  4. 8.4 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  5. 8.5 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  6. 8.6 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  7. 8.7 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  8. 8.8 modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  9. 10.3.x modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  10. 10.0.x modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  11. 10.1.x modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::supportsIndex()
  12. 10.2.x modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php \Drupal\social_search\Plugin\search_api\processor\SuperUser::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/SuperUser.php, line 27

Class

SuperUser
Adds access checks for profiles.

Namespace

Drupal\social_search\Plugin\search_api\processor

Code

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