diff --git a/core/modules/comment/src/Tests/CommentTestTrait.php b/core/modules/comment/src/Tests/CommentTestTrait.php index d8c54c2..72c6c35 100644 --- a/core/modules/comment/src/Tests/CommentTestTrait.php +++ b/core/modules/comment/src/Tests/CommentTestTrait.php @@ -34,8 +34,11 @@ * CommentItemInterface::OPEN. * @param string $comment_type_id * (optional) ID of comment type to use. Defaults to 'comment'. + * @param string $comment_view_mode + * (optional) The comment view mode to be used in comment field formatter. + * Defaults to 'full'. */ - public function addDefaultCommentField($entity_type, $bundle, $field_name = 'comment', $default_value = CommentItemInterface::OPEN, $comment_type_id = 'comment') { + public function addDefaultCommentField($entity_type, $bundle, $field_name = 'comment', $default_value = CommentItemInterface::OPEN, $comment_type_id = 'comment', $comment_view_mode = 'full') { $entity_manager = \Drupal::entityManager(); // Create the comment type if needed. $comment_type_storage = $entity_manager->getStorage('comment_type'); @@ -111,6 +114,7 @@ public function addDefaultCommentField($entity_type, $bundle, $field_name = 'com 'label' => 'above', 'type' => 'comment_default', 'weight' => 20, + 'settings' => array('view_mode' => $comment_view_mode), )) ->save(); foreach ($entity_manager->getViewModes($entity_type) as $id => $view_mode) {