You are here

public function ViewsSelection::getReferenceableEntities in Drupal 9

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

Gets the list of referenceable entities.

Parameters

string|null $match: (optional) Text to match the label against. Defaults to NULL.

string $match_operator: (optional) Operator to be used for string matching. Defaults to "CONTAINS".

int $limit: (optional) Limit the query to a given number of items. Defaults to 0, which indicates no limiting.

Return value

array A nested array of entities, the first level is keyed by the entity bundle, which contains an array of entity labels (escaped), keyed by the entity ID.

Overrides SelectionInterface::getReferenceableEntities

1 call to ViewsSelection::getReferenceableEntities()
ViewsSelection::countReferenceableEntities in core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
Counts entities that are referenceable.

File

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

Class

ViewsSelection
Plugin implementation of the 'selection' entity_reference.

Namespace

Drupal\views\Plugin\EntityReferenceSelection

Code

public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
  $entities = [];
  if ($display_execution_results = $this
    ->getDisplayExecutionResults($match, $match_operator, $limit)) {
    $entities = $this
      ->stripAdminAndAnchorTagsFromResults($display_execution_results);
  }
  return $entities;
}