3 namespace Drupal\Core\Entity\EntityReferenceSelection;
5 use Drupal\Component\Plugin\PluginManagerInterface;
6 use Drupal\Core\Entity\EntityInterface;
7 use Drupal\Core\Field\FieldDefinitionInterface;
10 * Defines an interface for the entity reference selection plugin manager.
12 interface SelectionPluginManagerInterface extends PluginManagerInterface {
15 * Gets the plugin ID for a given target entity type and base plugin ID.
17 * @param string $target_type
18 * The target entity type.
19 * @param string $base_plugin_id
20 * The base plugin ID (e.g. 'default' or 'views').
25 public function getPluginId($target_type, $base_plugin_id);
28 * Gets the selection plugins that can reference a specific entity type.
30 * @param string $entity_type_id
31 * A Drupal entity type ID.
34 * An array of selection plugins grouped by selection group.
36 public function getSelectionGroups($entity_type_id);
39 * Gets the selection handler for a given entity_reference field.
41 * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
42 * The field definition for the operation.
43 * @param \Drupal\Core\Entity\EntityInterface $entity
44 * (optional) The entity for the operation. Defaults to NULL.
46 * @return \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface
47 * The selection plugin.
49 public function getSelectionHandler(FieldDefinitionInterface $field_definition, EntityInterface $entity = NULL);