diff --git a/_config.php b/_config.php index 85a71c9..16d4798 100644 --- a/_config.php +++ b/_config.php @@ -28,4 +28,8 @@ if(class_exists('SiteTree') && !Commenting::has_commenting('SiteTree')) { Commenting::add('SiteTree'); +} + +if(class_exists('ContentController')) { + ContentController::add_extension('ContentControllerCommentsExtension'); } \ No newline at end of file diff --git a/code/extensions/CommentsExtension.php b/code/extensions/CommentsExtension.php index 6f28dcd..92427c4 100644 --- a/code/extensions/CommentsExtension.php +++ b/code/extensions/CommentsExtension.php @@ -47,7 +47,7 @@ class CommentsExtension extends DataExtension { * * @return PaginatedList */ - public function Comments() { + public function getComments() { $order = Commenting::get_config_value($this->ownerBaseClass, 'order_comments_by'); $list = Comment::get()->filter(array( @@ -132,7 +132,7 @@ class CommentsExtension extends DataExtension { 'Parent' => $this->owner, 'AddCommentForm' => $form, 'ModeratedSubmitted' => $moderatedSubmitted, - 'Comments' => $this->Comments() + 'Comments' => $this->getComments() ))); } diff --git a/code/extensions/ContentControllerCommentsExtension.php b/code/extensions/ContentControllerCommentsExtension.php new file mode 100644 index 0000000..af0e144 --- /dev/null +++ b/code/extensions/ContentControllerCommentsExtension.php @@ -0,0 +1,11 @@ +owner->dataRecord->getComments(); + } +} \ No newline at end of file