You are here

public function SelectionBase::validateReferencableEntities in Entity reference 8

Implements EntityReferenceHandler::validateReferencableEntities().

Overrides SelectionInterface::validateReferencableEntities

File

lib/Drupal/entityreference/Plugin/entityreference/selection/SelectionBase.php, line 193
Definition of Drupal\entityreference\Plugin\entityreference\selection\SelectionBase.

Class

SelectionBase
Plugin implementation of the 'selection' entityreference.

Namespace

Drupal\entityreference\Plugin\entityreference\selection

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();
}