You are here

public function ViewsSelection::validateReferenceableEntities in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php \Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::validateReferenceableEntities()

Validates which existing entities can be referenced.

Return value

array An array of valid entity IDs.

Overrides SelectionInterface::validateReferenceableEntities

File

core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php, line 317

Class

ViewsSelection
Plugin implementation of the 'selection' entity_reference.

Namespace

Drupal\views\Plugin\EntityReferenceSelection

Code

public function validateReferenceableEntities(array $ids) {
  $entities = $this
    ->getDisplayExecutionResults(NULL, 'CONTAINS', 0, $ids);
  $result = [];
  if ($entities) {
    $result = array_keys($entities);
  }
  return $result;
}