public function DefaultSelection::validateReferenceableEntities in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::validateReferenceableEntities()
Validates which existing entities can be referenced.
Return value
array An array of valid entity IDs.
Overrides SelectionInterface::validateReferenceableEntities
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ EntityReferenceSelection/ DefaultSelection.php, line 279 - Contains \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection.
Class
- DefaultSelection
- Default plugin implementation of the Entity Reference Selection plugin.
Namespace
Drupal\Core\Entity\Plugin\EntityReferenceSelectionCode
public function validateReferenceableEntities(array $ids) {
$result = array();
if ($ids) {
$target_type = $this->configuration['target_type'];
$entity_type = $this->entityManager
->getDefinition($target_type);
$query = $this
->buildEntityQuery();
$result = $query
->condition($entity_type
->getKey('id'), $ids, 'IN')
->execute();
}
return $result;
}