Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Entity / EntityReferenceSelection / SelectionPluginManagerInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity\EntityReferenceSelection;
4
5 use Drupal\Component\Plugin\PluginManagerInterface;
6 use Drupal\Core\Entity\EntityInterface;
7 use Drupal\Core\Field\FieldDefinitionInterface;
8
9 /**
10  * Defines an interface for the entity reference selection plugin manager.
11  */
12 interface SelectionPluginManagerInterface extends PluginManagerInterface {
13
14   /**
15    * Gets the plugin ID for a given target entity type and base plugin ID.
16    *
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').
21    *
22    * @return string
23    *   The plugin ID.
24    */
25   public function getPluginId($target_type, $base_plugin_id);
26
27   /**
28    * Gets the selection plugins that can reference a specific entity type.
29    *
30    * @param string $entity_type_id
31    *   A Drupal entity type ID.
32    *
33    * @return array
34    *   An array of selection plugins grouped by selection group.
35    */
36   public function getSelectionGroups($entity_type_id);
37
38   /**
39    * Gets the selection handler for a given entity_reference field.
40    *
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.
45    *
46    * @return \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface
47    *   The selection plugin.
48    */
49   public function getSelectionHandler(FieldDefinitionInterface $field_definition, EntityInterface $entity = NULL);
50
51 }