public function BlockedUsers::alterIndexedItems in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.2 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.3 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.4 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.5 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.6 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.7 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 8.8 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 10.3.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 10.0.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 10.1.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::alterIndexedItems()
- 10.2.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::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/ BlockedUsers.php, line 45
Class
- BlockedUsers
- Ignores blocked users in index and queries.
Namespace
Drupal\social_search\Plugin\search_api\processorCode
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
->getOwner()
->isBlocked() === TRUE) {
unset($items[$item_id]);
}
}
elseif ($object instanceof UserInterface) {
if ($object
->isBlocked() === TRUE) {
unset($items[$item_id]);
}
}
}
}