You are here

public function UserSelection::validateReferenceableEntities in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
  2. 8.8 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
  3. 10.3.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
  4. 10.0.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
  5. 10.2.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()

Validates which existing entities can be referenced.

Parameters

array $ids: An array of IDs to validate.

Return value

array An array of valid entity IDs.

Overrides DefaultSelection::validateReferenceableEntities

File

modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php, line 35

Class

UserSelection
Provides specific access control for the user entity type.

Namespace

Drupal\social_profile\Plugin\EntityReferenceSelection

Code

public function validateReferenceableEntities(array $ids) {
  $result = [];
  if ($ids) {
    $target_type = $this->configuration['target_type'];
    $entity_type = $this->entityTypeManager
      ->getDefinition($target_type);
    $query = $this
      ->buildEntityQuery(NULL, 'CONTAINS', $ids);
    $result = $query
      ->condition($entity_type
      ->getKey('id'), $ids, 'IN')
      ->execute();
  }
  return $result;
}