Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::getReferencableEntities().
Overrides SelectionInterface::getReferencableEntities
public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
$display_name = $this->instance['settings']['handler_settings']['view']['display_name'];
$arguments = $this->instance['settings']['handler_settings']['view']['arguments'];
$result = array();
if ($this
->initializeView($match, $match_operator, $limit)) {
// Get the results.
$result = $this->view
->executeDisplay($display_name, $arguments);
}
$return = array();
if ($result) {
foreach ($this->view->result as $row) {
$entity = $row->_entity;
$return[$entity
->bundle()][$entity
->id()] = $entity
->label();
}
}
return $return;
}