From 0a8235615d6f9d4035ca1dc53515a5ed01abeb3e Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Mon, 16 Apr 2018 11:54:45 +0100 Subject: [PATCH] Use Injector for creating paginated list of blog posts --- code/model/Blog.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/model/Blog.php b/code/model/Blog.php index 04fb83e..04702e2 100644 --- a/code/model/Blog.php +++ b/code/model/Blog.php @@ -1031,7 +1031,7 @@ class Blog_Controller extends Page_Controller { $allPosts = $this->blogPosts ?: new ArrayList(); - $posts = new PaginatedList($allPosts); + $posts = PaginatedList::create($allPosts); // Set appropriate page size if ($this->PostsPerPage > 0) { @@ -1049,13 +1049,13 @@ class Blog_Controller extends Page_Controller return $posts; } - + /** * Returns the absolute link to the next page for use in the page meta tags. This helps search engines * find the pagination and index all pages properly. - * + * * @example "<% if $PaginationAbsoluteNextLink %><% end_if %>" - * + * * @return string */ public function PaginationAbsoluteNextLink() { @@ -1068,7 +1068,7 @@ class Blog_Controller extends Page_Controller /** * Returns the absolute link to the previous page for use in the page meta tags. This helps search engines * find the pagination and index all pages properly. - * + * * @example "<% if $PaginationAbsolutePrevLink %><% end_if %>" * * @return string @@ -1079,7 +1079,7 @@ class Blog_Controller extends Page_Controller return Director::absoluteURL($posts->PrevLink()); } } - + /** * Displays an RSS feed of blog posts. * @@ -1164,5 +1164,5 @@ class Blog_Controller extends Page_Controller return false; } } - + }