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@0
|
51 * Loads the latest revision of a specific entity.
|
Chris@0
|
52 *
|
Chris@0
|
53 * @param string $entity_type_id
|
Chris@0
|
54 * The entity type ID.
|
Chris@0
|
55 * @param int $entity_id
|
Chris@0
|
56 * The entity ID.
|
Chris@0
|
57 *
|
Chris@0
|
58 * @return \Drupal\Core\Entity\ContentEntityInterface|null
|
Chris@0
|
59 * The latest entity revision or NULL, if the entity type / entity doesn't
|
Chris@0
|
60 * exist.
|
Chris@0
|
61 */
|
Chris@0
|
62 public function getLatestRevision($entity_type_id, $entity_id);
|
Chris@0
|
63
|
Chris@0
|
64 /**
|
Chris@0
|
65 * Returns the revision ID of the latest revision of the given entity.
|
Chris@0
|
66 *
|
Chris@0
|
67 * @param string $entity_type_id
|
Chris@0
|
68 * The entity type ID.
|
Chris@0
|
69 * @param int $entity_id
|
Chris@0
|
70 * The entity ID.
|
Chris@0
|
71 *
|
Chris@0
|
72 * @return int
|
Chris@0
|
73 * The revision ID of the latest revision for the specified entity, or
|
Chris@0
|
74 * NULL if there is no such entity.
|
Chris@0
|
75 */
|
Chris@0
|
76 public function getLatestRevisionId($entity_type_id, $entity_id);
|
Chris@0
|
77
|
Chris@0
|
78 /**
|
Chris@0
|
79 * Returns the revision ID of the default revision for the specified entity.
|
Chris@0
|
80 *
|
Chris@0
|
81 * @param string $entity_type_id
|
Chris@0
|
82 * The entity type ID.
|
Chris@0
|
83 * @param int $entity_id
|
Chris@0
|
84 * The entity ID.
|
Chris@0
|
85 *
|
Chris@0
|
86 * @return int
|
Chris@0
|
87 * The revision ID of the default revision, or NULL if the entity was
|
Chris@0
|
88 * not found.
|
Chris@0
|
89 */
|
Chris@0
|
90 public function getDefaultRevisionId($entity_type_id, $entity_id);
|
Chris@0
|
91
|
Chris@0
|
92 /**
|
Chris@0
|
93 * Returns the revision translation affected translation of a revision.
|
Chris@0
|
94 *
|
Chris@0
|
95 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
96 * The content entity.
|
Chris@0
|
97 *
|
Chris@0
|
98 * @return \Drupal\Core\Entity\ContentEntityInterface
|
Chris@0
|
99 * The revision translation affected translation.
|
Chris@0
|
100 */
|
Chris@0
|
101 public function getAffectedRevisionTranslation(ContentEntityInterface $entity);
|
Chris@0
|
102
|
Chris@0
|
103 /**
|
Chris@0
|
104 * Determines if an entity is a latest revision.
|
Chris@0
|
105 *
|
Chris@0
|
106 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
107 * A revisionable content entity.
|
Chris@0
|
108 *
|
Chris@0
|
109 * @return bool
|
Chris@0
|
110 * TRUE if the specified object is the latest revision of its entity,
|
Chris@0
|
111 * FALSE otherwise.
|
Chris@0
|
112 */
|
Chris@0
|
113 public function isLatestRevision(ContentEntityInterface $entity);
|
Chris@0
|
114
|
Chris@0
|
115 /**
|
Chris@0
|
116 * Determines if a pending revision exists for the specified entity.
|
Chris@0
|
117 *
|
Chris@0
|
118 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
119 * The entity which may or may not have a pending revision.
|
Chris@0
|
120 *
|
Chris@0
|
121 * @return bool
|
Chris@0
|
122 * TRUE if this entity has pending revisions available, FALSE otherwise.
|
Chris@0
|
123 */
|
Chris@0
|
124 public function hasPendingRevision(ContentEntityInterface $entity);
|
Chris@0
|
125
|
Chris@0
|
126 /**
|
Chris@0
|
127 * Determines if an entity is "live".
|
Chris@0
|
128 *
|
Chris@0
|
129 * A "live" entity revision is one whose latest revision is also the default,
|
Chris@0
|
130 * and whose moderation state, if any, is a published state.
|
Chris@0
|
131 *
|
Chris@0
|
132 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
133 * The entity to check.
|
Chris@0
|
134 *
|
Chris@0
|
135 * @return bool
|
Chris@0
|
136 * TRUE if the specified entity is a live revision, FALSE otherwise.
|
Chris@0
|
137 */
|
Chris@0
|
138 public function isLiveRevision(ContentEntityInterface $entity);
|
Chris@0
|
139
|
Chris@0
|
140 /**
|
Chris@0
|
141 * Determines if the default revision for the given entity is published.
|
Chris@0
|
142 *
|
Chris@0
|
143 * The default revision is the same as the entity retrieved by "default" from
|
Chris@0
|
144 * the storage handler. If the entity is translated, check if any of the
|
Chris@0
|
145 * translations are published.
|
Chris@0
|
146 *
|
Chris@0
|
147 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
148 * The entity being saved.
|
Chris@0
|
149 *
|
Chris@0
|
150 * @return bool
|
Chris@0
|
151 * TRUE if the default revision is published. FALSE otherwise.
|
Chris@0
|
152 */
|
Chris@0
|
153 public function isDefaultRevisionPublished(ContentEntityInterface $entity);
|
Chris@0
|
154
|
Chris@0
|
155 /**
|
Chris@0
|
156 * Gets the workflow for the given content entity.
|
Chris@0
|
157 *
|
Chris@0
|
158 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
|
Chris@0
|
159 * The content entity to get the workflow for.
|
Chris@0
|
160 *
|
Chris@0
|
161 * @return \Drupal\workflows\WorkflowInterface|null
|
Chris@0
|
162 * The workflow entity. NULL if there is no workflow.
|
Chris@0
|
163 */
|
Chris@0
|
164 public function getWorkflowForEntity(ContentEntityInterface $entity);
|
Chris@0
|
165
|
Chris@0
|
166 }
|