1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 11:44:42 +02:00

Add hasNext() and hasPrev() methods to PaginatedArray class

This commit is contained in:
Ryan Cramer
2018-11-21 10:49:53 -05:00
parent b083c96717
commit cc212b3254

View File

@@ -138,6 +138,30 @@ class PaginatedArray extends WireArray implements WirePaginatable {
return $this->numStart;
}
/**
* Is there a next pagination containing more items in this PaginatedArray after the current one?
*
* #pw-group-other
*
* @return int
*
*/
public function hasNext() {
return $this->getStart() + $this->count() < $this->getTotal();
}
/**
* Is there a previous pagination before the current one?
*
* #pw-group-other
*
* @return bool
*
*/
public function hasPrev() {
return $this->getStart() > 0;
}
/**
* Get a property of the PageArray
*