function entity_reference_get_selection_handler

Gets the selection handler for a given entity_reference field.

Return value

\Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface

7 calls to entity_reference_get_selection_handler()
AutocompleteTagsWidget::elementValidate in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteTagsWidget.php
Overrides \Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase::elementValidate()
AutocompleteWidget::elementValidate in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidget.php
Overrides \Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase::elementValidate()
EntityReferenceAutocomplete::getMatches in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php
Returns matched labels based on a given field, instance and search string.
EntityReferenceSelectionAccessTest::assertReferencable in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
EntityReferenceSelectionSortTest::testSort in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
Assert sorting by field and property.

... See full list

File

drupal/core/modules/entity_reference/entity_reference.module, line 83
Provides a field that can reference other entities.

Code

function entity_reference_get_selection_handler($field, $instance, EntityInterface $entity = NULL) {
  $options = array(
    'field' => $field,
    'instance' => $instance,
    'entity' => $entity,
  );
  return Drupal::service('plugin.manager.entity_reference.selection')
    ->getInstance($options);
}