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:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user