d861287bb7540b30abacfebf9e50659ab2291680
[yaffs-website] / web / modules / contrib / entityqueue / src / EntityQueueInterface.php
1 <?php
2
3 namespace Drupal\entityqueue;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6
7 /**
8  * Provides an interface defining a EntityQueue entity.
9  */
10 interface EntityQueueInterface extends ConfigEntityInterface {
11
12   /**
13    * Gets the EntityQueueHandler plugin id.
14    *
15    * @return string
16    */
17   public function getHandler();
18
19   /**
20    * Sets the EntityQueueHandler.
21    *
22    * @param string $handler
23    *   The handler name.
24    *
25    * @return $this
26    */
27   public function setHandler($handler);
28
29   /**
30    * Gets the EntityQueueHandler plugin object.
31    *
32    * @return EntityQueueHandlerInterface
33    */
34   public function getHandlerPlugin();
35
36   /**
37    * Gets the ID of the target entity type.
38    *
39    * @return string
40    *   The target entity type ID.
41    */
42   public function getTargetEntityTypeId();
43
44   /**
45    * Gets the minimum number of items that this queue can hold.
46    *
47    * @return int
48    */
49   public function getMinimumSize();
50
51   /**
52    * Gets the maximum number of items that this queue can hold.
53    *
54    * @return int
55    */
56   public function getMaximumSize();
57
58   /**
59    * Returns the behavior of exceeding the maximum number of queue items.
60    *
61    * If TRUE, when a maximum size is set and it is exceeded, the queue will be
62    * truncated to the maximum size by removing items from the front of the
63    * queue.
64    *
65    * @return bool
66    */
67   public function getActAsQueue();
68
69   /**
70    * Returns the behavior of editing the queue's items.
71    *
72    * Ordinarily, queues are arranged with the front of the queue (where items
73    * will be removed) on top, and the back (where items will be added) on the
74    * bottom.
75    *
76    * If TRUE, this will display the queue such that items will be added to the
77    * top and removed from the bottom.
78    *
79    * @return bool
80    */
81   public function getReverseInAdmin();
82
83   /**
84    * Gets the selection settings used by a subqueue's 'items' reference field.
85    *
86    * @return array
87    *   An array with the following keys:
88    *   - target_type: The type of the entities that will be queued.
89    *   - handler: The entity reference selection handler that will be used by
90    *     the subqueue's 'items' field.
91    *   - handler_settings: The entity reference selection handler settings that
92    *     will be used by the subqueue's 'items' field.
93    */
94   public function getEntitySettings();
95
96   /**
97    * Gets the queue settings.
98    *
99    * @return array
100    *   An array with the following keys:
101    *   - min_size: The minimum number of items that this queue can hold.
102    *   - max_size: The maximum number of items that this queue can hold.
103    *   - act_as_queue: The behavior of exceeding the maximum number of queue
104    *     items.
105    *   - reverse_in_admin: Show the items in reverse order when editing a
106    *     subqueue.
107    */
108   public function getQueueSettings();
109
110   /**
111    * Loads one or more queues based on their target entity type.
112    *
113    * @param string $target_entity_type_id
114    *   The target entity type ID.
115    *
116    * @return static[]
117    *   An array of entity queue objects, indexed by their IDs.
118    */
119   public static function loadMultipleByTargetType($target_entity_type_id);
120
121 }