public function UserSelection::validateReferenceableEntities in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
- 8.8 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
- 10.0.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
- 10.1.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::validateReferenceableEntities()
- 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\EntityReferenceSelectionCode
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;
}