annotate core/modules/comment/src/CommentInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
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@17 59 * @return \Drupal\Core\Entity\FieldableEntityInterface|null
Chris@17 60 * The entity on which the comment is attached or NULL if the comment is an
Chris@17 61 * orphan.
Chris@0 62 */
Chris@0 63 public function getCommentedEntity();
Chris@0 64
Chris@0 65 /**
Chris@0 66 * Returns the ID of the entity to which the comment is attached.
Chris@0 67 *
Chris@0 68 * @return int
Chris@0 69 * The ID of the entity to which the comment is attached.
Chris@0 70 */
Chris@0 71 public function getCommentedEntityId();
Chris@0 72
Chris@0 73 /**
Chris@0 74 * Returns the type of the entity to which the comment is attached.
Chris@0 75 *
Chris@0 76 * @return string
Chris@0 77 * An entity type.
Chris@0 78 */
Chris@0 79 public function getCommentedEntityTypeId();
Chris@0 80
Chris@0 81 /**
Chris@0 82 * Sets the field ID for which this comment is attached.
Chris@0 83 *
Chris@0 84 * @param string $field_name
Chris@0 85 * The field name through which the comment was added.
Chris@0 86 *
Chris@0 87 * @return $this
Chris@0 88 * The class instance that this method is called on.
Chris@0 89 */
Chris@0 90 public function setFieldName($field_name);
Chris@0 91
Chris@0 92 /**
Chris@0 93 * Returns the name of the field the comment is attached to.
Chris@0 94 *
Chris@0 95 * @return string
Chris@0 96 * The name of the field the comment is attached to.
Chris@0 97 */
Chris@0 98 public function getFieldName();
Chris@0 99
Chris@0 100 /**
Chris@0 101 * Returns the subject of the comment.
Chris@0 102 *
Chris@0 103 * @return string
Chris@0 104 * The subject of the comment.
Chris@0 105 */
Chris@0 106 public function getSubject();
Chris@0 107
Chris@0 108 /**
Chris@0 109 * Sets the subject of the comment.
Chris@0 110 *
Chris@0 111 * @param string $subject
Chris@0 112 * The subject of the comment.
Chris@0 113 *
Chris@0 114 * @return $this
Chris@0 115 * The class instance that this method is called on.
Chris@0 116 */
Chris@0 117 public function setSubject($subject);
Chris@0 118
Chris@0 119 /**
Chris@0 120 * Returns the comment author's name.
Chris@0 121 *
Chris@0 122 * For anonymous authors, this is the value as typed in the comment form.
Chris@0 123 *
Chris@0 124 * @return string
Chris@0 125 * The name of the comment author.
Chris@0 126 */
Chris@0 127 public function getAuthorName();
Chris@0 128
Chris@0 129 /**
Chris@0 130 * Sets the name of the author of the comment.
Chris@0 131 *
Chris@0 132 * @param string $name
Chris@0 133 * A string containing the name of the author.
Chris@0 134 *
Chris@0 135 * @return $this
Chris@0 136 * The class instance that this method is called on.
Chris@0 137 */
Chris@0 138 public function setAuthorName($name);
Chris@0 139
Chris@0 140 /**
Chris@0 141 * Returns the comment author's email address.
Chris@0 142 *
Chris@0 143 * For anonymous authors, this is the value as typed in the comment form.
Chris@0 144 *
Chris@0 145 * @return string
Chris@0 146 * The email address of the author of the comment.
Chris@0 147 */
Chris@0 148 public function getAuthorEmail();
Chris@0 149
Chris@0 150 /**
Chris@0 151 * Returns the comment author's home page address.
Chris@0 152 *
Chris@0 153 * For anonymous authors, this is the value as typed in the comment form.
Chris@0 154 *
Chris@0 155 * @return string
Chris@0 156 * The homepage address of the author of the comment.
Chris@0 157 */
Chris@0 158 public function getHomepage();
Chris@0 159
Chris@0 160 /**
Chris@0 161 * Sets the comment author's home page address.
Chris@0 162 *
Chris@0 163 * For anonymous authors, this is the value as typed in the comment form.
Chris@0 164 *
Chris@0 165 * @param string $homepage
Chris@0 166 * The homepage address of the author of the comment.
Chris@0 167 *
Chris@0 168 * @return $this
Chris@0 169 * The class instance that this method is called on.
Chris@0 170 */
Chris@0 171 public function setHomepage($homepage);
Chris@0 172
Chris@0 173 /**
Chris@0 174 * Returns the comment author's hostname.
Chris@0 175 *
Chris@0 176 * @return string
Chris@0 177 * The hostname of the author of the comment.
Chris@0 178 */
Chris@0 179 public function getHostname();
Chris@0 180
Chris@0 181 /**
Chris@0 182 * Sets the hostname of the author of the comment.
Chris@0 183 *
Chris@0 184 * @param string $hostname
Chris@0 185 * The hostname of the author of the comment.
Chris@0 186 *
Chris@0 187 * @return $this
Chris@0 188 * The class instance that this method is called on.
Chris@0 189 */
Chris@0 190 public function setHostname($hostname);
Chris@0 191
Chris@0 192 /**
Chris@0 193 * Returns the time that the comment was created.
Chris@0 194 *
Chris@0 195 * @return int
Chris@0 196 * The timestamp of when the comment was created.
Chris@0 197 */
Chris@0 198 public function getCreatedTime();
Chris@0 199
Chris@0 200 /**
Chris@0 201 * Sets the creation date of the comment.
Chris@0 202 *
Chris@0 203 * @param int $created
Chris@0 204 * The timestamp of when the comment was created.
Chris@0 205 *
Chris@0 206 * @return $this
Chris@0 207 * The class instance that this method is called on.
Chris@0 208 */
Chris@0 209 public function setCreatedTime($created);
Chris@0 210
Chris@0 211 /**
Chris@0 212 * Returns the comment's status.
Chris@0 213 *
Chris@0 214 * @return int
Chris@0 215 * One of CommentInterface::PUBLISHED or CommentInterface::NOT_PUBLISHED
Chris@0 216 *
Chris@0 217 * @deprecated in Drupal 8.3.0, will be removed before Drupal 9.0.0. Use
Chris@0 218 * \Drupal\Core\Entity\EntityPublishedInterface::isPublished() instead.
Chris@0 219 */
Chris@0 220 public function getStatus();
Chris@0 221
Chris@0 222 /**
Chris@0 223 * Returns the alphadecimal representation of the comment's place in a thread.
Chris@0 224 *
Chris@0 225 * @return string
Chris@0 226 * The alphadecimal representation of the comment's place in a thread.
Chris@0 227 */
Chris@0 228 public function getThread();
Chris@0 229
Chris@0 230 /**
Chris@0 231 * Sets the alphadecimal representation of the comment's place in a thread.
Chris@0 232 *
Chris@0 233 * @param string $thread
Chris@0 234 * The alphadecimal representation of the comment's place in a thread.
Chris@0 235 *
Chris@0 236 * @return $this
Chris@0 237 * The class instance that this method is called on.
Chris@0 238 */
Chris@0 239 public function setThread($thread);
Chris@0 240
Chris@0 241 /**
Chris@0 242 * Returns the permalink URL for this comment.
Chris@0 243 *
Chris@0 244 * @return \Drupal\Core\Url
Chris@0 245 */
Chris@0 246 public function permalink();
Chris@0 247
Chris@0 248 /**
Chris@0 249 * Get the comment type id for this comment.
Chris@0 250 *
Chris@0 251 * @return string
Chris@0 252 * The id of the comment type.
Chris@0 253 */
Chris@0 254 public function getTypeId();
Chris@0 255
Chris@0 256 }