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