public function CommentStorageController::baseFieldDefinitions

Implements \Drupal\Core\Entity\DataBaseStorageControllerNG::basePropertyDefinitions().

Overrides DatabaseStorageController::baseFieldDefinitions

File

drupal/core/modules/comment/lib/Drupal/comment/CommentStorageController.php, line 262
Definition of Drupal\comment\CommentStorageController.

Class

CommentStorageController
Defines the controller class for comments.

Namespace

Drupal\comment

Code

public function baseFieldDefinitions() {
  $properties['cid'] = array(
    'label' => t('ID'),
    'description' => t('The comment ID.'),
    'type' => 'integer_field',
    'read-only' => TRUE,
  );
  $properties['uuid'] = array(
    'label' => t('UUID'),
    'description' => t('The comment UUID.'),
    'type' => 'string_field',
  );
  $properties['pid'] = array(
    'label' => t('Parent ID'),
    'description' => t('The parent comment ID if this is a reply to a comment.'),
    'type' => 'entity_reference_field',
    'settings' => array(
      'target_type' => 'comment',
    ),
  );
  $properties['nid'] = array(
    'label' => t('Node ID'),
    'description' => t('The ID of the node of which this comment is a reply.'),
    'type' => 'entity_reference_field',
    'settings' => array(
      'target_type' => 'node',
    ),
    'required' => TRUE,
  );
  $properties['langcode'] = array(
    'label' => t('Language code'),
    'description' => t('The comment language code.'),
    'type' => 'language_field',
  );
  $properties['subject'] = array(
    'label' => t('Subject'),
    'description' => t('The comment title or subject.'),
    'type' => 'string_field',
  );
  $properties['uid'] = array(
    'label' => t('User ID'),
    'description' => t('The user ID of the comment author.'),
    'type' => 'entity_reference_field',
    'settings' => array(
      'target_type' => 'user',
    ),
  );
  $properties['name'] = array(
    'label' => t('Name'),
    'description' => t("The comment author's name."),
    'type' => 'string_field',
  );
  $properties['mail'] = array(
    'label' => t('e-mail'),
    'description' => t("The comment author's e-mail address."),
    'type' => 'string_field',
  );
  $properties['homepage'] = array(
    'label' => t('Homepage'),
    'description' => t("The comment author's home page address."),
    'type' => 'string_field',
  );
  $properties['hostname'] = array(
    'label' => t('Hostname'),
    'description' => t("The comment author's hostname."),
    'type' => 'string_field',
  );
  $properties['created'] = array(
    'label' => t('Created'),
    'description' => t('The time that the comment was created.'),
    'type' => 'integer_field',
  );
  $properties['changed'] = array(
    'label' => t('Changed'),
    'description' => t('The time that the comment was last edited.'),
    'type' => 'integer_field',
  );
  $properties['status'] = array(
    'label' => t('Publishing status'),
    'description' => t('A boolean indicating whether the comment is published.'),
    'type' => 'boolean_field',
  );
  $properties['thread'] = array(
    'label' => t('Thread place'),
    'description' => t("The alphadecimal representation of the comment's place in a thread, consisting of a base 36 string prefixed by an integer indicating its length."),
    'type' => 'string_field',
  );
  $properties['node_type'] = array(
    // @todo: The bundle property should be stored so it's queryable.
    'label' => t('Node type'),
    'description' => t("The comment node type."),
    'type' => 'string_field',
    'queryable' => FALSE,
  );
  $properties['new'] = array(
    'label' => t('Comment new marker'),
    'description' => t("The comment 'new' marker for the current user (0 read, 1 new, 2 updated)."),
    'type' => 'integer_field',
    'computed' => TRUE,
    'class' => '\\Drupal\\comment\\FieldNewItem',
  );
  return $properties;
}