Merge pull request #528 from kinglozzer/injector

Use Injector for creating paginated list of blog posts
This commit is contained in:
Daniel Hensby 2018-04-16 12:09:50 +01:00 committed by GitHub
commit 66c7881410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -1030,7 +1030,7 @@ class Blog_Controller extends Page_Controller
{ {
$allPosts = $this->blogPosts ?: new ArrayList(); $allPosts = $this->blogPosts ?: new ArrayList();
$posts = new PaginatedList($allPosts); $posts = PaginatedList::create($allPosts);
// Set appropriate page size // Set appropriate page size
if ($this->PostsPerPage > 0) { if ($this->PostsPerPage > 0) {
@ -1048,13 +1048,13 @@ class Blog_Controller extends Page_Controller
return $posts; return $posts;
} }
/** /**
* Returns the absolute link to the next page for use in the page meta tags. This helps search engines * 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. * find the pagination and index all pages properly.
* *
* @example "<% if $PaginationAbsoluteNextLink %><link rel="next" href="$PaginationAbsoluteNextLink"><% end_if %>" * @example "<% if $PaginationAbsoluteNextLink %><link rel="next" href="$PaginationAbsoluteNextLink"><% end_if %>"
* *
* @return string * @return string
*/ */
public function PaginationAbsoluteNextLink() { public function PaginationAbsoluteNextLink() {
@ -1067,7 +1067,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 * 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. * find the pagination and index all pages properly.
* *
* @example "<% if $PaginationAbsolutePrevLink %><link rel="prev" href="$PaginationAbsolutePrevLink"><% end_if %>" * @example "<% if $PaginationAbsolutePrevLink %><link rel="prev" href="$PaginationAbsolutePrevLink"><% end_if %>"
* *
* @return string * @return string
@ -1078,7 +1078,7 @@ class Blog_Controller extends Page_Controller
return Director::absoluteURL($posts->PrevLink()); return Director::absoluteURL($posts->PrevLink());
} }
} }
/** /**
* Displays an RSS feed of blog posts. * Displays an RSS feed of blog posts.
* *
@ -1163,5 +1163,5 @@ class Blog_Controller extends Page_Controller
return false; return false;
} }
} }
} }