public function ViewsSelection::validateReferenceableEntities in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 249 - Contains \Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection.
Class
- ViewsSelection
- Plugin implementation of the 'selection' entity_reference.
Namespace
Drupal\views\Plugin\EntityReferenceSelectionCode
public function validateReferenceableEntities(array $ids) {
$handler_settings = $this->configuration['handler_settings'];
$display_name = $handler_settings['view']['display_name'];
$arguments = $handler_settings['view']['arguments'];
$result = array();
if ($this
->initializeView(NULL, 'CONTAINS', 0, $ids)) {
// Get the results.
$entities = $this->view
->executeDisplay($display_name, $arguments);
$result = array_keys($entities);
}
return $result;
}