class CommentTestBaseField
Same name and namespace in other branches
- 11.x core/modules/comment/tests/modules/comment_base_field_test/src/Entity/CommentTestBaseField.php \Drupal\comment_base_field_test\Entity\CommentTestBaseField
- 10 core/modules/comment/tests/modules/comment_base_field_test/src/Entity/CommentTestBaseField.php \Drupal\comment_base_field_test\Entity\CommentTestBaseField
- 8.9.x core/modules/comment/tests/modules/comment_base_field_test/src/Entity/CommentTestBaseField.php \Drupal\comment_base_field_test\Entity\CommentTestBaseField
Defines a test entity class for comment as a base field.
Plugin annotation
@ContentEntityType(
id = "comment_test_base_field",
label = @Translation("Test comment - base field"),
base_table = "comment_test_base_field",
entity_keys = {
"id" = "id",
"uuid" = "uuid",
"bundle" = "type"
},
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Entity\EntityInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, \Drupal\Core\Entity\ContentEntityInterface, \Drupal\Core\TypedData\TranslationStatusInterface uses \Drupal\Core\Entity\EntityChangesDetectionTrait, \Drupal\Core\Entity\SynchronizableEntityTrait extends \Drupal\Core\Entity\EntityBase
- class \Drupal\entity_test\Entity\EntityTest implements \Drupal\user\EntityOwnerInterface extends \Drupal\Core\Entity\ContentEntityBase
- class \Drupal\comment_base_field_test\Entity\CommentTestBaseField extends \Drupal\entity_test\Entity\EntityTest
- class \Drupal\entity_test\Entity\EntityTest implements \Drupal\user\EntityOwnerInterface extends \Drupal\Core\Entity\ContentEntityBase
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, \Drupal\Core\Entity\ContentEntityInterface, \Drupal\Core\TypedData\TranslationStatusInterface uses \Drupal\Core\Entity\EntityChangesDetectionTrait, \Drupal\Core\Entity\SynchronizableEntityTrait extends \Drupal\Core\Entity\EntityBase
Expanded class hierarchy of CommentTestBaseField
1 file declares its use of CommentTestBaseField
- CommentBaseFieldTest.php in core/
modules/ comment/ tests/ src/ Kernel/ CommentBaseFieldTest.php
File
-
core/
modules/ comment/ tests/ modules/ comment_base_field_test/ src/ Entity/ CommentTestBaseField.php, line 24
Namespace
Drupal\comment_base_field_test\EntityView source
class CommentTestBaseField extends EntityTest {
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['test_comment'] = BaseFieldDefinition::create('comment')->setLabel(t('A comment field'))
->setSetting('comment_type', 'test_comment_type')
->setDefaultValue([
'status' => CommentItemInterface::OPEN,
]);
return $fields;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.