Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Comment.php

function Comment::bundleFieldDefinitions

Overrides ContentEntityBase::bundleFieldDefinitions

File

core/modules/comment/src/Entity/Comment.php, line 339

Class

Comment
Defines the comment entity class.

Namespace

Drupal\comment\Entity

Code

public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
    if ($comment_type = CommentType::load($bundle)) {
        $fields['entity_id'] = clone $base_field_definitions['entity_id'];
        $fields['entity_id']->setSetting('target_type', $comment_type->getTargetEntityTypeId());
        return $fields;
    }
    return [];
}
RSS feed
Powered by Drupal