Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\comment;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Entity\ContentEntityInterface;
|
Chris@0
|
6 use Drupal\Core\Entity\EntityPublishedInterface;
|
Chris@0
|
7 use Drupal\user\EntityOwnerInterface;
|
Chris@0
|
8 use Drupal\Core\Entity\EntityChangedInterface;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Provides an interface defining a comment entity.
|
Chris@0
|
12 */
|
Chris@0
|
13 interface CommentInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface, EntityPublishedInterface {
|
Chris@0
|
14
|
Chris@0
|
15 /**
|
Chris@0
|
16 * Comment is awaiting approval.
|
Chris@0
|
17 */
|
Chris@0
|
18 const NOT_PUBLISHED = 0;
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Comment is published.
|
Chris@0
|
22 */
|
Chris@0
|
23 const PUBLISHED = 1;
|
Chris@0
|
24
|
Chris@0
|
25 /**
|
Chris@0
|
26 * Anonymous posters cannot enter their contact information.
|
Chris@0
|
27 */
|
Chris@0
|
28 const ANONYMOUS_MAYNOT_CONTACT = 0;
|
Chris@0
|
29
|
Chris@0
|
30 /**
|
Chris@0
|
31 * Anonymous posters may leave their contact information.
|
Chris@0
|
32 */
|
Chris@0
|
33 const ANONYMOUS_MAY_CONTACT = 1;
|
Chris@0
|
34
|
Chris@0
|
35 /**
|
Chris@0
|
36 * Anonymous posters are required to leave their contact information.
|
Chris@0
|
37 */
|
Chris@0
|
38 const ANONYMOUS_MUST_CONTACT = 2;
|
Chris@0
|
39
|
Chris@0
|
40 /**
|
Chris@0
|
41 * Determines if this comment is a reply to another comment.
|
Chris@0
|
42 *
|
Chris@0
|
43 * @return bool
|
Chris@0
|
44 * TRUE if the comment has a parent comment otherwise FALSE.
|
Chris@0
|
45 */
|
Chris@0
|
46 public function hasParentComment();
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Returns the parent comment entity if this is a reply to a comment.
|
Chris@0
|
50 *
|
Chris@0
|
51 * @return \Drupal\comment\CommentInterface|null
|
Chris@0
|
52 * A comment entity of the parent comment or NULL if there is no parent.
|
Chris@0
|
53 */
|
Chris@0
|
54 public function getParentComment();
|
Chris@0
|
55
|
Chris@0
|
56 /**
|
Chris@0
|
57 * Returns the entity to which the comment is attached.
|
Chris@0
|
58 *
|
Chris@0
|
59 * @return \Drupal\Core\Entity\FieldableEntityInterface
|
Chris@0
|
60 * The entity on which the comment is attached.
|
Chris@0
|
61 */
|
Chris@0
|
62 public function getCommentedEntity();
|
Chris@0
|
63
|
Chris@0
|
64 /**
|
Chris@0
|
65 * Returns the ID of the entity to which the comment is attached.
|
Chris@0
|
66 *
|
Chris@0
|
67 * @return int
|
Chris@0
|
68 * The ID of the entity to which the comment is attached.
|
Chris@0
|
69 */
|
Chris@0
|
70 public function getCommentedEntityId();
|
Chris@0
|
71
|
Chris@0
|
72 /**
|
Chris@0
|
73 * Returns the type of the entity to which the comment is attached.
|
Chris@0
|
74 *
|
Chris@0
|
75 * @return string
|
Chris@0
|
76 * An entity type.
|
Chris@0
|
77 */
|
Chris@0
|
78 public function getCommentedEntityTypeId();
|
Chris@0
|
79
|
Chris@0
|
80 /**
|
Chris@0
|
81 * Sets the field ID for which this comment is attached.
|
Chris@0
|
82 *
|
Chris@0
|
83 * @param string $field_name
|
Chris@0
|
84 * The field name through which the comment was added.
|
Chris@0
|
85 *
|
Chris@0
|
86 * @return $this
|
Chris@0
|
87 * The class instance that this method is called on.
|
Chris@0
|
88 */
|
Chris@0
|
89 public function setFieldName($field_name);
|
Chris@0
|
90
|
Chris@0
|
91 /**
|
Chris@0
|
92 * Returns the name of the field the comment is attached to.
|
Chris@0
|
93 *
|
Chris@0
|
94 * @return string
|
Chris@0
|
95 * The name of the field the comment is attached to.
|
Chris@0
|
96 */
|
Chris@0
|
97 public function getFieldName();
|
Chris@0
|
98
|
Chris@0
|
99 /**
|
Chris@0
|
100 * Returns the subject of the comment.
|
Chris@0
|
101 *
|
Chris@0
|
102 * @return string
|
Chris@0
|
103 * The subject of the comment.
|
Chris@0
|
104 */
|
Chris@0
|
105 public function getSubject();
|
Chris@0
|
106
|
Chris@0
|
107 /**
|
Chris@0
|
108 * Sets the subject of the comment.
|
Chris@0
|
109 *
|
Chris@0
|
110 * @param string $subject
|
Chris@0
|
111 * The subject of the comment.
|
Chris@0
|
112 *
|
Chris@0
|
113 * @return $this
|
Chris@0
|
114 * The class instance that this method is called on.
|
Chris@0
|
115 */
|
Chris@0
|
116 public function setSubject($subject);
|
Chris@0
|
117
|
Chris@0
|
118 /**
|
Chris@0
|
119 * Returns the comment author's name.
|
Chris@0
|
120 *
|
Chris@0
|
121 * For anonymous authors, this is the value as typed in the comment form.
|
Chris@0
|
122 *
|
Chris@0
|
123 * @return string
|
Chris@0
|
124 * The name of the comment author.
|
Chris@0
|
125 */
|
Chris@0
|
126 public function getAuthorName();
|
Chris@0
|
127
|
Chris@0
|
128 /**
|
Chris@0
|
129 * Sets the name of the author of the comment.
|
Chris@0
|
130 *
|
Chris@0
|
131 * @param string $name
|
Chris@0
|
132 * A string containing the name of the author.
|
Chris@0
|
133 *
|
Chris@0
|
134 * @return $this
|
Chris@0
|
135 * The class instance that this method is called on.
|
Chris@0
|
136 */
|
Chris@0
|
137 public function setAuthorName($name);
|
Chris@0
|
138
|
Chris@0
|
139 /**
|
Chris@0
|
140 * Returns the comment author's email address.
|
Chris@0
|
141 *
|
Chris@0
|
142 * For anonymous authors, this is the value as typed in the comment form.
|
Chris@0
|
143 *
|
Chris@0
|
144 * @return string
|
Chris@0
|
145 * The email address of the author of the comment.
|
Chris@0
|
146 */
|
Chris@0
|
147 public function getAuthorEmail();
|
Chris@0
|
148
|
Chris@0
|
149 /**
|
Chris@0
|
150 * Returns the comment author's home page address.
|
Chris@0
|
151 *
|
Chris@0
|
152 * For anonymous authors, this is the value as typed in the comment form.
|
Chris@0
|
153 *
|
Chris@0
|
154 * @return string
|
Chris@0
|
155 * The homepage address of the author of the comment.
|
Chris@0
|
156 */
|
Chris@0
|
157 public function getHomepage();
|
Chris@0
|
158
|
Chris@0
|
159 /**
|
Chris@0
|
160 * Sets the comment author's home page address.
|
Chris@0
|
161 *
|
Chris@0
|
162 * For anonymous authors, this is the value as typed in the comment form.
|
Chris@0
|
163 *
|
Chris@0
|
164 * @param string $homepage
|
Chris@0
|
165 * The homepage address of the author of the comment.
|
Chris@0
|
166 *
|
Chris@0
|
167 * @return $this
|
Chris@0
|
168 * The class instance that this method is called on.
|
Chris@0
|
169 */
|
Chris@0
|
170 public function setHomepage($homepage);
|
Chris@0
|
171
|
Chris@0
|
172 /**
|
Chris@0
|
173 * Returns the comment author's hostname.
|
Chris@0
|
174 *
|
Chris@0
|
175 * @return string
|
Chris@0
|
176 * The hostname of the author of the comment.
|
Chris@0
|
177 */
|
Chris@0
|
178 public function getHostname();
|
Chris@0
|
179
|
Chris@0
|
180 /**
|
Chris@0
|
181 * Sets the hostname of the author of the comment.
|
Chris@0
|
182 *
|
Chris@0
|
183 * @param string $hostname
|
Chris@0
|
184 * The hostname of the author of the comment.
|
Chris@0
|
185 *
|
Chris@0
|
186 * @return $this
|
Chris@0
|
187 * The class instance that this method is called on.
|
Chris@0
|
188 */
|
Chris@0
|
189 public function setHostname($hostname);
|
Chris@0
|
190
|
Chris@0
|
191 /**
|
Chris@0
|
192 * Returns the time that the comment was created.
|
Chris@0
|
193 *
|
Chris@0
|
194 * @return int
|
Chris@0
|
195 * The timestamp of when the comment was created.
|
Chris@0
|
196 */
|
Chris@0
|
197 public function getCreatedTime();
|
Chris@0
|
198
|
Chris@0
|
199 /**
|
Chris@0
|
200 * Sets the creation date of the comment.
|
Chris@0
|
201 *
|
Chris@0
|
202 * @param int $created
|
Chris@0
|
203 * The timestamp of when the comment was created.
|
Chris@0
|
204 *
|
Chris@0
|
205 * @return $this
|
Chris@0
|
206 * The class instance that this method is called on.
|
Chris@0
|
207 */
|
Chris@0
|
208 public function setCreatedTime($created);
|
Chris@0
|
209
|
Chris@0
|
210 /**
|
Chris@0
|
211 * Returns the comment's status.
|
Chris@0
|
212 *
|
Chris@0
|
213 * @return int
|
Chris@0
|
214 * One of CommentInterface::PUBLISHED or CommentInterface::NOT_PUBLISHED
|
Chris@0
|
215 *
|
Chris@0
|
216 * @deprecated in Drupal 8.3.0, will be removed before Drupal 9.0.0. Use
|
Chris@0
|
217 * \Drupal\Core\Entity\EntityPublishedInterface::isPublished() instead.
|
Chris@0
|
218 */
|
Chris@0
|
219 public function getStatus();
|
Chris@0
|
220
|
Chris@0
|
221 /**
|
Chris@0
|
222 * Returns the alphadecimal representation of the comment's place in a thread.
|
Chris@0
|
223 *
|
Chris@0
|
224 * @return string
|
Chris@0
|
225 * The alphadecimal representation of the comment's place in a thread.
|
Chris@0
|
226 */
|
Chris@0
|
227 public function getThread();
|
Chris@0
|
228
|
Chris@0
|
229 /**
|
Chris@0
|
230 * Sets the alphadecimal representation of the comment's place in a thread.
|
Chris@0
|
231 *
|
Chris@0
|
232 * @param string $thread
|
Chris@0
|
233 * The alphadecimal representation of the comment's place in a thread.
|
Chris@0
|
234 *
|
Chris@0
|
235 * @return $this
|
Chris@0
|
236 * The class instance that this method is called on.
|
Chris@0
|
237 */
|
Chris@0
|
238 public function setThread($thread);
|
Chris@0
|
239
|
Chris@0
|
240 /**
|
Chris@0
|
241 * Returns the permalink URL for this comment.
|
Chris@0
|
242 *
|
Chris@0
|
243 * @return \Drupal\Core\Url
|
Chris@0
|
244 */
|
Chris@0
|
245 public function permalink();
|
Chris@0
|
246
|
Chris@0
|
247 /**
|
Chris@0
|
248 * Get the comment type id for this comment.
|
Chris@0
|
249 *
|
Chris@0
|
250 * @return string
|
Chris@0
|
251 * The id of the comment type.
|
Chris@0
|
252 */
|
Chris@0
|
253 public function getTypeId();
|
Chris@0
|
254
|
Chris@0
|
255 }
|