function CommentItem::propertyDefinitions

Same name and namespace in other branches
  1. 9 core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php \Drupal\comment\Plugin\Field\FieldType\CommentItem::propertyDefinitions()
  2. 8.9.x core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php \Drupal\comment\Plugin\Field\FieldType\CommentItem::propertyDefinitions()
  3. 10 core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php \Drupal\comment\Plugin\Field\FieldType\CommentItem::propertyDefinitions()

Overrides FieldItemInterface::propertyDefinitions

File

core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php, line 58

Class

CommentItem
Plugin implementation of the 'comment' field type.

Namespace

Drupal\comment\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
    $properties['status'] = DataDefinition::create('integer')->setLabel(new TranslatableMarkup('Comment status'))
        ->setRequired(TRUE);
    $properties['cid'] = DataDefinition::create('integer')->setLabel(new TranslatableMarkup('Last comment ID'));
    $properties['last_comment_timestamp'] = DataDefinition::create('integer')->setLabel(new TranslatableMarkup('Last comment timestamp'))
        ->setDescription(new TranslatableMarkup('The time that the last comment was created.'));
    $properties['last_comment_name'] = DataDefinition::create('string')->setLabel(new TranslatableMarkup('Last comment name'))
        ->setDescription(new TranslatableMarkup('The name of the user posting the last comment.'));
    $properties['last_comment_uid'] = DataDefinition::create('integer')->setLabel(new TranslatableMarkup('Last comment user ID'));
    $properties['comment_count'] = DataDefinition::create('integer')->setLabel(new TranslatableMarkup('Number of comments'))
        ->setDescription(new TranslatableMarkup('The number of comments.'));
    return $properties;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.