From ba2b06212d1b8a758228e139d7f1b13e3bf35b1c Mon Sep 17 00:00:00 2001 From: Tom Densham Date: Sat, 20 Jul 2024 22:01:10 +0100 Subject: [PATCH] Added `$startIndex` param to `Pos` method --- src/Models/BaseElement.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Models/BaseElement.php b/src/Models/BaseElement.php index bb1c6179..b31aff33 100644 --- a/src/Models/BaseElement.php +++ b/src/Models/BaseElement.php @@ -1261,11 +1261,12 @@ public function TotalItems() /** * Returns the position of the current element. * + * @param int $startIndex Number to start count from. * @return int */ - public function Pos() + public function Pos($startIndex = 1) { - return ($this->Parent()->Elements()->filter('Sort:LessThan', $this->Sort)->count() + 1); + return ($this->Parent()->Elements()->filter('Sort:LessThan', $this->Sort)->count() + $startIndex); } /**