Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make page_count and current accessible from Twig #58

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion classes/plugin/PaginationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(Collection $collection)
}

$this->items_per_page = $params['limit'];
$this->page_count = ceil($collection->count() / $this->items_per_page);
$this->page_count = intval(ceil($collection->count() / $this->items_per_page));
kylxbn marked this conversation as resolved.
Show resolved Hide resolved

for ($x=1; $x <= $this->page_count; $x++) {
if ($x === 1) {
Expand Down Expand Up @@ -125,6 +125,8 @@ public function nextUrl()

/**
* Return the current page
*
* @return int
*/
public function currentPage()
{
Expand All @@ -133,6 +135,8 @@ public function currentPage()

/**
* Return the items per page
*
* @return int
*/
public function itemsPerPage()
{
Expand All @@ -141,6 +145,8 @@ public function itemsPerPage()

/**
* Return the total number of pages
*
* @return int
*/
public function pageCount()
{
Expand Down