function CommentStorageInterface::loadThread

Same name in other branches
  1. 9 core/modules/comment/src/CommentStorageInterface.php \Drupal\comment\CommentStorageInterface::loadThread()
  2. 8.9.x core/modules/comment/src/CommentStorageInterface.php \Drupal\comment\CommentStorageInterface::loadThread()
  3. 11.x core/modules/comment/src/CommentStorageInterface.php \Drupal\comment\CommentStorageInterface::loadThread()

Retrieves comments for a thread, sorted in an order suitable for display.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity whose comment(s) needs rendering.

string $field_name: The field_name whose comment(s) needs rendering.

int $mode: The comment display mode: CommentManagerInterface::COMMENT_MODE_FLAT or CommentManagerInterface::COMMENT_MODE_THREADED.

int $comments_per_page: (optional) The amount of comments to display per page. Defaults to 0, which means show all comments.

int $pager_id: (optional) Pager id to use in case of multiple pagers on the one page. Defaults to 0; is only used when $comments_per_page is greater than zero.

Return value

array Ordered array of comment objects, keyed by comment id.

1 method overrides CommentStorageInterface::loadThread()
CommentStorage::loadThread in core/modules/comment/src/CommentStorage.php
To display threaded comments in the correct order we keep a 'thread' field and order by that value. This field keeps this data in a way which is easy to update and convenient to use.

File

core/modules/comment/src/CommentStorageInterface.php, line 106

Class

CommentStorageInterface
Defines an interface for comment entity storage classes.

Namespace

Drupal\comment

Code

public function loadThread(EntityInterface $entity, $field_name, $mode, $comments_per_page = 0, $pager_id = 0);

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