comparison core/modules/comment/src/CommentInterface.php @ 0:4c8ae668cc8c

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