@@ 239-247 (lines=9) @@ | ||
236 | * |
|
237 | * @return DataList |
|
238 | */ |
|
239 | public function AllComments() |
|
240 | { |
|
241 | $order = $this->owner->getCommentsOption('order_comments_by'); |
|
242 | $comments = Comment::get() |
|
243 | ->filter('ParentID', $this->owner->ID) |
|
244 | ->sort($order); |
|
245 | $this->owner->extend('updateAllComments', $comments); |
|
246 | return $comments; |
|
247 | } |
|
248 | ||
249 | /** |
|
250 | * Returns all comments against this object, with with spam and unmoderated items excluded, for use in the frontend |
|
@@ 280-291 (lines=12) @@ | ||
277 | * |
|
278 | * @return DataList |
|
279 | */ |
|
280 | public function Comments() |
|
281 | { |
|
282 | $list = $this->AllVisibleComments(); |
|
283 | ||
284 | // If nesting comments, only show root level |
|
285 | if ($this->owner->getCommentsOption('nested_comments')) { |
|
286 | $list = $list->filter('ParentCommentID', 0); |
|
287 | } |
|
288 | ||
289 | $this->owner->extend('updateComments', $list); |
|
290 | return $list; |
|
291 | } |
|
292 | ||
293 | /** |
|
294 | * Returns a paged list of the root level comments, with spam and unmoderated items excluded, |