comment_view

comment_view(CommentInterface $comment, $view_mode = 'full', $langcode = NULL)

Generates an array for rendering a comment.

Parameters

\Drupal\comment\CommentInterface $comment: The comment object.

string $view_mode: (optional) View mode; for instance, 'full', 'teaser', etc. Defaults to 'full'.

string $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

Return value

array An array as expected by drupal_render().

Deprecated

in Drupal 8.x and will be removed before Drupal 9.0. Use \Drupal::entityManager()->getViewBuilder('comment')->view().

File

core/modules/comment/comment.module, line 261
Enables users to comment on published content.

Code

function comment_view(CommentInterface $comment, $view_mode = 'full', $langcode = NULL) {
  return entity_view($comment, $view_mode, $langcode);
}
doc_Drupal
2016-10-29 08:51:31
Comments
Leave a Comment

Please login to continue.