1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-07 23:38:29 +02:00

Updated PaginatedArray::getTotal() method to return the count() quantity when no total has been set (previously it returned 0 if not set)

This commit is contained in:
Ryan Cramer
2023-03-31 09:42:26 -04:00
parent 134edd9445
commit dad712ebb2

View File

@@ -13,7 +13,7 @@
* #pw-body * #pw-body
* #pw-summary-manipulation In most cases you will not need these manipulation methods as core API calls already take care of this. * #pw-summary-manipulation In most cases you will not need these manipulation methods as core API calls already take care of this.
* *
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer * ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com * https://processwire.com
* *
* @method string renderPager(array $options = array()) Renders pagination, when MarkupPageArray module installed * @method string renderPager(array $options = array()) Renders pagination, when MarkupPageArray module installed
@@ -79,7 +79,9 @@ class PaginatedArray extends WireArray implements WirePaginatable {
* *
*/ */
public function getTotal() { public function getTotal() {
return $this->numTotal; $total = $this->numTotal;
if(!$total) $total = $this->count();
return $total;
} }
/** /**
@@ -327,4 +329,4 @@ class PaginatedArray extends WireArray implements WirePaginatable {
} }
return $info; return $info;
} }
} }