You are here

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

Alter the items to be indexed.

Parameters

\Drupal\search_api\Item\ItemInterface[] $items: An array of items to be indexed, passed by reference.

Overrides ProcessorPluginBase::alterIndexedItems

File

modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php, line 40

Class

SuperUser
Adds access checks for profiles.

Namespace

Drupal\social_search\Plugin\search_api\processor

Code

public function alterIndexedItems(array &$items) {
  foreach ($items as $item_id => $item) {
    $object = $item
      ->getOriginalObject()
      ->getValue();
    if ($object instanceof ProfileInterface) {

      // Profile ownedId is the userId.
      if ($object
        ->getOwnerId() == '1') {
        unset($items[$item_id]);
      }
    }
    elseif ($object instanceof UserInterface) {
      if ($object
        ->id() == '1') {
        unset($items[$item_id]);
      }
    }
  }
}