public function SelectionBase::validateReferencableEntities

Implements SelectionInterface::validateReferencableEntities().

Overrides SelectionInterface::validateReferencableEntities

File

drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php, line 204
Contains \Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase.

Class

SelectionBase
Plugin implementation of the 'selection' entity_reference.

Namespace

Drupal\entity_reference\Plugin\entity_reference\selection

Code

public function validateReferencableEntities(array $ids) {
  $result = array();
  if ($ids) {
    $target_type = $this->field['settings']['target_type'];
    $entity_info = entity_get_info($target_type);
    $query = $this
      ->buildEntityQuery();
    $result = $query
      ->condition($entity_info['entity_keys']['id'], $ids, 'IN')
      ->execute();
  }
  return $result;
}