class Comment

Defines the comment entity class.

Plugin annotation


@Plugin(
  id = "comment",
  label = @Translation("Comment"),
  module = "comment",
  controller_class = "Drupal\comment\CommentStorageController",
  render_controller_class = "Drupal\comment\CommentRenderController",
  form_controller_class = {
    "default" = "Drupal\comment\CommentFormController"
  },
  translation_controller_class = "Drupal\comment\CommentTranslationController",
  base_table = "comment",
  uri_callback = "comment_uri",
  fieldable = TRUE,
  static_cache = FALSE,
  entity_keys = {
    "id" = "cid",
    "bundle" = "node_type",
    "label" = "subject",
    "uuid" = "uuid"
  },
  view_modes = {
    "full" = {
      "label" = "Full comment",
      "custom_settings" = FALSE
    }
  }
)

Hierarchy

Expanded class hierarchy of Comment

3 files declare their use of Comment
comment.admin.inc in drupal/core/modules/comment/comment.admin.inc
Admin page callbacks for the Comment module.
comment.module in drupal/core/modules/comment/comment.module
Enables users to comment on published content.
CommentTestBase.php in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
Contains Drupal\comment\Tests\CommentTestBase.
26 string references to 'Comment'
CommentActionsTest::getInfo in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
CommentAnonymousTest::getInfo in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
CommentApprovalTest::getInfo in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentApprovalTest.php
CommentBlockTest::getInfo in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php
CommentContentRebuildTest::getInfo in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentContentRebuildTest.php

... See full list

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php, line 46
Definition of Drupal\comment\Plugin\Core\Entity\Comment.

Namespace

Drupal\comment\Plugin\Core\Entity
View source
class Comment extends Entity implements ContentEntityInterface {

  /**
   * The comment ID.
   *
   * @var integer
   */
  public $cid;

  /**
   * The comment UUID.
   *
   * @var string
   */
  public $uuid;

  /**
   * The parent comment ID if this is a reply to a comment.
   *
   * @var integer
   */
  public $pid;

  /**
   * The ID of the node to which the comment is attached.
   */
  public $nid;

  /**
   * The comment language code.
   *
   * @var string
   */
  public $langcode = LANGUAGE_NOT_SPECIFIED;

  /**
   * The comment title.
   *
   * @var string
   */
  public $subject;

  /**
   * The comment author ID.
   *
   * @var integer
   */
  public $uid = 0;

  /**
   * The comment author's name.
   *
   * For anonymous authors, this is the value as typed in the comment form.
   *
   * @var string
   */
  public $name = '';

  /**
   * The comment author's e-mail address.
   *
   * For anonymous authors, this is the value as typed in the comment form.
   *
   * @var string
   */
  public $mail;

  /**
   * The comment author's home page address.
   *
   * For anonymous authors, this is the value as typed in the comment form.
   *
   * @var string
   */
  public $homepage;

  /**
   * Implements Drupal\Core\Entity\EntityInterface::id().
   */
  public function id() {
    return $this->cid;
  }

  /**
   * Implements Drupal\Core\Entity\EntityInterface::bundle().
   */
  public function bundle() {
    return $this->node_type;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Comment::$cid public property The comment ID.
Comment::$homepage public property The comment author's home page address.
Comment::$langcode public property The comment language code. Overrides Entity::$langcode
Comment::$mail public property The comment author's e-mail address.
Comment::$name public property The comment author's name.
Comment::$nid public property The ID of the node to which the comment is attached.
Comment::$pid public property The parent comment ID if this is a reply to a comment.
Comment::$subject public property The comment title.
Comment::$uid public property The comment author ID.
Comment::$uuid public property The comment UUID.
Comment::bundle public function Implements Drupal\Core\Entity\EntityInterface::bundle(). Overrides Entity::bundle
Comment::id public function Implements Drupal\Core\Entity\EntityInterface::id(). Overrides Entity::id
Entity::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
Entity::$entityType protected property The entity type.
Entity::$isDefaultRevision protected property Indicates whether this is the default revision. 1
Entity::$newRevision protected property Boolean indicating whether a new revision should be created on save.
Entity::access public function Implements AccessibleInterface::access(). Overrides AccessibleInterface::access
Entity::createDuplicate public function Implements EntityInterface::createDuplicate(). Overrides EntityInterface::createDuplicate 3
Entity::delete public function Implements EntityInterface::delete(). Overrides EntityInterface::delete
Entity::enforceIsNew public function Implements EntityInterface::enforceIsNew(). Overrides EntityInterface::enforceIsNew
Entity::entityInfo public function Implements EntityInterface::entityInfo(). Overrides EntityInterface::entityInfo
Entity::entityType public function Implements EntityInterface::entityType(). Overrides EntityInterface::entityType
Entity::get public function Implements EntityInterface::get(). Overrides ComplexDataInterface::get 2
Entity::getIterator public function Implements ComplexDataInterface::getIterator(). 1
Entity::getProperties public function Implements ComplexDataInterface::getProperties(). Overrides ComplexDataInterface::getProperties 1
Entity::getPropertyDefinition public function Implements ComplexDataInterface::getPropertyDefinition(). Overrides ComplexDataInterface::getPropertyDefinition 1
Entity::getPropertyDefinitions public function Implements ComplexDataInterface::getPropertyDefinitions(). Overrides ComplexDataInterface::getPropertyDefinitions 1
Entity::getPropertyValues public function Implements ComplexDataInterface::getPropertyValues(). Overrides ComplexDataInterface::getPropertyValues 1
Entity::getRevisionId public function Implements Drupal\Core\Entity\EntityInterface::getRevisionId(). Overrides EntityInterface::getRevisionId 3
Entity::getTranslation public function Implements TranslatableInterface::getTranslation(). Overrides TranslatableInterface::getTranslation 1
Entity::getTranslationLanguages public function Implements TranslatableInterface::getTranslationLanguages(). Overrides TranslatableInterface::getTranslationLanguages 1
Entity::isDefaultRevision public function Implements Drupal\Core\Entity\EntityInterface::isDefaultRevision(). Overrides EntityInterface::isDefaultRevision 1
Entity::isEmpty public function Implements ComplexDataInterface::isEmpty(). Overrides ComplexDataInterface::isEmpty 1
Entity::isNew public function Implements EntityInterface::isNew(). Overrides EntityInterface::isNew 1
Entity::isNewRevision public function Implements EntityInterface::isNewRevision(). Overrides EntityInterface::isNewRevision
Entity::label public function Implements EntityInterface::label(). Overrides EntityInterface::label 1
Entity::language public function Implements TranslatableInterface::language(). Overrides TranslatableInterface::language 1
Entity::save public function Implements EntityInterface::save(). Overrides EntityInterface::save 3
Entity::set public function Implements ComplexDataInterface::set(). Overrides ComplexDataInterface::set 2
Entity::setNewRevision public function Implements EntityInterface::setNewRevision(). Overrides EntityInterface::setNewRevision
Entity::setPropertyValues public function Implements ComplexDataInterface::setPropertyValues(). Overrides ComplexDataInterface::setPropertyValues 1
Entity::translations public function Returns the languages the entity is translated to.
Entity::uri public function Implements EntityInterface::uri(). Overrides EntityInterface::uri 1
Entity::uuid public function Implements EntityInterface::uuid(). Overrides EntityInterface::uuid 1
Entity::__construct public function Constructs an Entity object. 2