Skip to content

Commit

Permalink
Added $startIndex param to Pos method
Browse files Browse the repository at this point in the history
  • Loading branch information
nedmas authored Jul 20, 2024
1 parent 97d9b3d commit ba2b062
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit ba2b062

Please sign in to comment.