function comment_view_multiple

Same name in other branches
  1. 7.x modules/comment/comment.module \comment_view_multiple()

Constructs render array from an array of loaded comments.

Parameters

\Drupal\comment\CommentInterface[] $comments: An array of comments as returned by entity_load_multiple().

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

string $langcode: (optional) A string indicating the language field values are to be shown in. If no language is provided the current content language is used. Defaults to NULL.

Return value

array An array in the format expected by \Drupal\Core\Render\RendererInterface::render().

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('comment')->viewMultiple().

See also

https://www.drupal.org/node/3033656

\Drupal\Core\Render\RendererInterface::render()

1 call to comment_view_multiple()
CommentLegacyTest::testCommentView in core/modules/comment/tests/src/Kernel/CommentLegacyTest.php
@expectedDeprecation comment_view() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('comment')->view() instead. Seeā€¦

File

core/modules/comment/comment.module, line 312

Code

function comment_view_multiple($comments, $view_mode = 'full', $langcode = NULL) {
    @trigger_error("comment_view_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal::entityTypeManager()->getViewBuilder('comment')->viewMultiple() instead. See https://www.drupal.org/node/3033656", E_USER_DEPRECATED);
    return \Drupal::entityTypeManager()->getViewBuilder('comment')
        ->viewMultiple($comments, $view_mode, $langcode);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.