Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\content_moderation;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Entity\ContentEntityInterface;
|
Chris@0
|
6 use Drupal\Core\Entity\EntityInterface;
|
Chris@0
|
7 use Drupal\Core\Entity\EntityTypeInterface;
|
Chris@0
|
8
|
Chris@0
|
9 /**
|
Chris@0
|
10 * Interface for moderation_information service.
|
Chris@0
|
11 */
|
Chris@0
|
12 interface ModerationInformationInterface {
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Determines if an entity is moderated.
|
Chris@0
|
16 *
|
Chris@0
|
17 * @param \Drupal\Core\Entity\EntityInterface $entity
|
Chris@0
|
18 * The entity we may be moderating.
|
Chris@0
|
19 *
|
Chris@0
|
20 * @return bool
|
Chris@0
|
21 * TRUE if this entity is moderated, FALSE otherwise.
|
Chris@0
|
22 */
|
Chris@0
|
23 public function isModeratedEntity(EntityInterface $entity);
|
Chris@0
|
24
|
Chris@0
|
25 /**
|
Chris@0
|
26 * Determines if an entity type can have moderated entities.
|
Chris@0
|
27 *
|
Chris@0
|
28 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
Chris@0
|
29 * An entity type object.
|
Chris@0
|
30 *
|
Chris@0
|
31 * @return bool
|
Chris@0
|
32 * TRUE if this entity type can have moderated entities, FALSE otherwise.
|
Chris@0
|
33 */
|
Chris@0
|
34 public function canModerateEntitiesOfEntityType(EntityTypeInterface $entity_type);
|
Chris@0
|
35
|
Chris@0
|
36 /**
|
Chris@0
|
37 * Determines if an entity type/bundle entities should be moderated.
|
Chris@0
|
38 *
|
Chris@0
|
39 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
Chris@0
|
40 * The entity type definition to check.
|
Chris@0
|
41 * @param string $bundle
|
Chris@0
|
42 * The bundle to check.
|
Chris@0
|
43 *
|
Chris@0
|
44 * @return bool
|
Chris@0
|
45 * TRUE if an entity type/bundle entities should be moderated, FALSE
|
Chris@0
|
46 * otherwise.
|
Chris@0
|
47 */
|
Chris@0
|
48 public function shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, $bundle);
|
Chris@0
|
49
|
Chris@0
|
50 /**
|
Chris@18
|
51 * Determines if an entity type has at least one moderated bundle.
|
Chris@18
|
52 *
|
Chris@18
|
53 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
Chris@18
|
54 * The entity type definition to check.
|
Chris@18
|
55 *
|
Chris@18
|
56 * @return bool
|
Chris@18
|
57 * TRUE if an entity type has a moderated bundle, FALSE otherwise.
|
Chris@18
|
58 */
|
Chris@18
|
59 public function isModeratedEntityType(EntityTypeInterface $entity_type);
|
Chris@18
|
60
|
Chris@18
|
61 /**
|
Chris@0
|
62 * Loads the latest revision of a specific entity.
|
Chris@0
|
63 *
|
Chris@0
|
64 * @param string $entity_type_id
|
Chris@0
|
65 * The entity type ID.
|
Chris@0
|
66 * @param int $entity_id
|
Chris@0
|
67 * The entity ID.
|
Chris@0
|
68 *
|
Chris@0
|
69 * @return \Drupal\Core\Entity\ContentEntityInterface|null
|
Chris@0
|
70 * The latest entity revision or NULL, if the entity type / entity doesn't
|
Chris@0
|
71 * exist.
|
Chris@0
|
72 */
|
Chris@0
|
73 public function getLatestRevision($entity_type_id, $entity_id);
|
Chris@0
|
74
|
Chris@0
|
75 /**
|
Chris@0
|
76 * Returns the revision ID of the latest revision of the given entity.
|
Chris@0
|
77 *
|
Chris@0
|
78 * @param string $entity_type_id
|
Chris@0
|
79 * The entity type ID.
|
Chris@0
|
80 * @param int $entity_id
|
Chris@0
|
81 * The entity ID.
|
Chris@0
|
82 *
|
Chris@0
|
83 * @return int
|
Chris@0
|
84 * The revision ID of the latest revision for the specified entity, or
|
Chris@0
|
85 * NULL if there is no such entity.
|
Chris@0
|
86 */
|
Chris@0
|
87 public function getLatestRevisionId($entity_type_id, $entity_id);
|
Chris@0
|
88
|
Chris@0
|
89 /**
|
Chris@0
|
90 * Returns the revision ID of the default revision for the specified entity.
|
Chris@0
|
91 *
|
Chris@0
|
92 * @param string $entity_type_id
|
Chris@0
|
93 * The entity type ID.
|
Chris@0
|
94 * @param int $entity_id
|
Chris@0
|
95 * The entity ID.
|
Chris@0
|
96 *
|
Chris@0
|
97 * @return int
|
Chris@0
|
98 * The revision ID of the default revision, or NULL if the entity was
|
Chris@0
|
99 * not found.
|
Chris@0
|
100 */
|
Chris@0
|
101 public function getDefaultRevisionId($entity_type_id, $entity_id);
|
Chris@0
|
102
|
Chris@0
|
103 /**
|
Chris@0
|
104 * Returns the revision translation affected translation of a revision.
|
Chris@0
|
105 *
|
Chris@0
|
106 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
107 * The content entity.
|
Chris@0
|
108 *
|
Chris@0
|
109 * @return \Drupal\Core\Entity\ContentEntityInterface
|
Chris@0
|
110 * The revision translation affected translation.
|
Chris@0
|
111 */
|
Chris@0
|
112 public function getAffectedRevisionTranslation(ContentEntityInterface $entity);
|
Chris@0
|
113
|
Chris@0
|
114 /**
|
Chris@0
|
115 * Determines if an entity is a latest revision.
|
Chris@0
|
116 *
|
Chris@0
|
117 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
118 * A revisionable content entity.
|
Chris@0
|
119 *
|
Chris@0
|
120 * @return bool
|
Chris@0
|
121 * TRUE if the specified object is the latest revision of its entity,
|
Chris@0
|
122 * FALSE otherwise.
|
Chris@0
|
123 */
|
Chris@0
|
124 public function isLatestRevision(ContentEntityInterface $entity);
|
Chris@0
|
125
|
Chris@0
|
126 /**
|
Chris@0
|
127 * Determines if a pending revision exists for the specified entity.
|
Chris@0
|
128 *
|
Chris@0
|
129 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
130 * The entity which may or may not have a pending revision.
|
Chris@0
|
131 *
|
Chris@0
|
132 * @return bool
|
Chris@0
|
133 * TRUE if this entity has pending revisions available, FALSE otherwise.
|
Chris@0
|
134 */
|
Chris@0
|
135 public function hasPendingRevision(ContentEntityInterface $entity);
|
Chris@0
|
136
|
Chris@0
|
137 /**
|
Chris@0
|
138 * Determines if an entity is "live".
|
Chris@0
|
139 *
|
Chris@0
|
140 * A "live" entity revision is one whose latest revision is also the default,
|
Chris@0
|
141 * and whose moderation state, if any, is a published state.
|
Chris@0
|
142 *
|
Chris@0
|
143 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
144 * The entity to check.
|
Chris@0
|
145 *
|
Chris@0
|
146 * @return bool
|
Chris@0
|
147 * TRUE if the specified entity is a live revision, FALSE otherwise.
|
Chris@0
|
148 */
|
Chris@0
|
149 public function isLiveRevision(ContentEntityInterface $entity);
|
Chris@0
|
150
|
Chris@0
|
151 /**
|
Chris@0
|
152 * Determines if the default revision for the given entity is published.
|
Chris@0
|
153 *
|
Chris@0
|
154 * The default revision is the same as the entity retrieved by "default" from
|
Chris@0
|
155 * the storage handler. If the entity is translated, check if any of the
|
Chris@0
|
156 * translations are published.
|
Chris@0
|
157 *
|
Chris@0
|
158 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
159 * The entity being saved.
|
Chris@0
|
160 *
|
Chris@0
|
161 * @return bool
|
Chris@0
|
162 * TRUE if the default revision is published. FALSE otherwise.
|
Chris@0
|
163 */
|
Chris@0
|
164 public function isDefaultRevisionPublished(ContentEntityInterface $entity);
|
Chris@0
|
165
|
Chris@0
|
166 /**
|
Chris@0
|
167 * Gets the workflow for the given content entity.
|
Chris@0
|
168 *
|
Chris@0
|
169 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
170 * The content entity to get the workflow for.
|
Chris@0
|
171 *
|
Chris@0
|
172 * @return \Drupal\workflows\WorkflowInterface|null
|
Chris@0
|
173 * The workflow entity. NULL if there is no workflow.
|
Chris@0
|
174 */
|
Chris@0
|
175 public function getWorkflowForEntity(ContentEntityInterface $entity);
|
Chris@0
|
176
|
Chris@17
|
177 /**
|
Chris@18
|
178 * Gets the workflow for the given entity type and bundle.
|
Chris@18
|
179 *
|
Chris@18
|
180 * @param string $entity_type_id
|
Chris@18
|
181 * The entity type ID.
|
Chris@18
|
182 * @param string $bundle_id
|
Chris@18
|
183 * The entity bundle ID.
|
Chris@18
|
184 *
|
Chris@18
|
185 * @return \Drupal\workflows\WorkflowInterface|null
|
Chris@18
|
186 * The associated workflow. NULL if there is no workflow.
|
Chris@18
|
187 */
|
Chris@18
|
188 public function getWorkflowForEntityTypeAndBundle($entity_type_id, $bundle_id);
|
Chris@18
|
189
|
Chris@18
|
190 /**
|
Chris@17
|
191 * Gets unsupported features for a given entity type.
|
Chris@17
|
192 *
|
Chris@17
|
193 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
Chris@17
|
194 * The entity type to get the unsupported features for.
|
Chris@17
|
195 *
|
Chris@17
|
196 * @return array
|
Chris@17
|
197 * An array of unsupported features for this entity type.
|
Chris@17
|
198 */
|
Chris@17
|
199 public function getUnsupportedFeatures(EntityTypeInterface $entity_type);
|
Chris@17
|
200
|
Chris@0
|
201 }
|