summaryrefslogtreecommitdiffstats
path: root/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php')
-rw-r--r--core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php
index de01c9c..492fa25 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceAutocomplete.php
@@ -4,9 +4,11 @@
* @file
* Contains \Drupal\entity_reference/EntityReferenceAutocomplete.
*/
+
namespace Drupal\entity_reference;
use Drupal\Core\Entity\EntityManager;
+use Drupal\entity_reference\Plugin\Type\SelectionPluginManager;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
/**
@@ -22,13 +24,23 @@ class EntityReferenceAutocomplete {
protected $entityManager;
/**
+ * The Entity reference selection handler plugin manager.
+ *
+ * @var \Drupal\entity_reference\Plugin\Type\SelectionPluginManager
+ */
+ protected $selectionHandlerManager;
+
+ /**
* Constructs a EntityReferenceAutocomplete object.
*
* @param \Drupal\Core\Entity\EntityManager $entity_manager
* The entity manager.
+ * @param \Drupal\entity_reference\Plugin\Type\SelectionPluginManager $selection_manager
+ * The Entity reference selection handler plugin manager.
*/
- public function __construct(EntityManager $entity_manager) {
+ public function __construct(EntityManager $entity_manager, SelectionPluginManager $selection_manager) {
$this->entityManager = $entity_manager;
+ $this->selectionHandlerManager = $selection_manager;
}
/**
@@ -60,7 +72,6 @@ class EntityReferenceAutocomplete {
* @see \Drupal\entity_reference\EntityReferenceController
*/
public function getMatches($field, $instance, $entity_type, $entity_id = '', $prefix = '', $string = '') {
- $target_type = $field['settings']['target_type'];
$matches = array();
$entity = NULL;
@@ -70,7 +81,7 @@ class EntityReferenceAutocomplete {
throw new AccessDeniedHttpException();
}
}
- $handler = entity_reference_get_selection_handler($instance, $entity);
+ $handler = $this->selectionHandlerManager->getSelectionHandler($instance, $entity);
if (isset($string)) {
// Get an array of matching entities.