You are here

function comment_view in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/comment.module \comment_view()

Generates an array for rendering a comment.

Parameters

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

$view_mode: (optional) View mode; e.g., 'full', 'teaser', etc. Defaults to 'full'.

$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().

2 calls to comment_view()
comment_preview in core/modules/comment/comment.module
Generates a comment preview.
Rss::render in core/modules/comment/src/Plugin/views/row/Rss.php
Render a row object. This usually passes through to a theme template of some form, but not always.
1 string reference to 'comment_view'
CommentDefaultFormatterCacheTagsTest::testCacheTags in core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
Tests the bubbling of cache tags.

File

core/modules/comment/comment.module, line 259
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);
}