Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Entity / EntityReferenceSelection / SelectionInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity\EntityReferenceSelection;
4
5 use Drupal\Core\Database\Query\SelectInterface;
6 use Drupal\Core\Plugin\PluginFormInterface;
7
8 /**
9  * Interface definition for Entity Reference Selection plugins.
10  *
11  * @see \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager
12  * @see \Drupal\Core\Entity\Annotation\EntityReferenceSelection
13  * @see plugin_api
14  */
15 interface SelectionInterface extends PluginFormInterface {
16
17   /**
18    * Gets the list of referenceable entities.
19    *
20    * @return array
21    *   A nested array of entities, the first level is keyed by the
22    *   entity bundle, which contains an array of entity labels (escaped),
23    *   keyed by the entity ID.
24    */
25   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0);
26
27   /**
28    * Counts entities that are referenceable.
29    *
30    * @return int
31    *   The number of referenceable entities.
32    */
33   public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS');
34
35   /**
36    * Validates which existing entities can be referenced.
37    *
38    * @return array
39    *   An array of valid entity IDs.
40    */
41   public function validateReferenceableEntities(array $ids);
42
43   /**
44    * Allows the selection to alter the SelectQuery generated by EntityFieldQuery.
45    *
46    * @param \Drupal\Core\Database\Query\SelectInterface $query
47    *   A Select Query object.
48    */
49   public function entityQueryAlter(SelectInterface $query);
50
51 }