You are here

public function EntityReference_SelectionHandler_Generic::validateReferencableEntities in Entity reference 7

Implements EntityReferenceHandler::validateReferencableEntities().

Overrides EntityReference_SelectionHandler::validateReferencableEntities

File

plugins/selection/EntityReference_SelectionHandler_Generic.class.php, line 193

Class

EntityReference_SelectionHandler_Generic
A generic Entity handler.

Code

public function validateReferencableEntities(array $ids) {
  if ($ids) {
    $entity_type = $this->field['settings']['target_type'];
    $query = $this
      ->buildEntityFieldQuery();
    $query
      ->entityCondition('entity_id', $ids, 'IN');
    $result = $query
      ->execute();
    if (!empty($result[$entity_type])) {
      return array_keys($result[$entity_type]);
    }
  }
  return array();
}