function CommentItem::generateSampleValue
Same name in other branches
- 9 core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php \Drupal\comment\Plugin\Field\FieldType\CommentItem::generateSampleValue()
- 10 core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php \Drupal\comment\Plugin\Field\FieldType\CommentItem::generateSampleValue()
- 11.x core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php \Drupal\comment\Plugin\Field\FieldType\CommentItem::generateSampleValue()
Overrides FieldItemBase::generateSampleValue
File
-
core/
modules/ comment/ src/ Plugin/ Field/ FieldType/ CommentItem.php, line 201
Class
- CommentItem
- Plugin implementation of the 'comment' field type.
Namespace
Drupal\comment\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$statuses = [
CommentItemInterface::HIDDEN,
CommentItemInterface::CLOSED,
CommentItemInterface::OPEN,
];
return [
'status' => $statuses[mt_rand(0, count($statuses) - 1)],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.