You are here

public function ProfileUserStatus::alterIndexedItems in Profile 8

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

src/Plugin/search_api/processor/ProfileUserStatus.php, line 39

Class

ProfileUserStatus
Adds access checks for profiles.

Namespace

Drupal\profile\Plugin\search_api\processor

Code

public function alterIndexedItems(array &$items) {
  foreach ($items as $item_id => $item) {
    $object = $item
      ->getOriginalObject()
      ->getValue();
    if ($object instanceof ProfileInterface) {
      $user = $object
        ->getOwner();
      if (!$user
        ->isActive()) {
        unset($items[$item_id]);
      }
    }
  }
}