Skip to content

Commit

Permalink
Add IsFirst/IsLast methods to match SS5 conventions (closes #1274)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinglozzer committed Nov 12, 2024
1 parent 5f8f754 commit 01173bf
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,22 +1231,26 @@ public function getPageTitle()
return null;
}

/**
* @return boolean
*/
public function First()
public function IsFirst(): bool
{
return ($this->Parent()->Elements()->first()->ID === $this->ID);
}

/**
* @return boolean
*/
public function Last()
public function First()
{
return $this->IsFirst();
}

public function IsLast(): bool
{
return ($this->Parent()->Elements()->last()->ID === $this->ID);
}

public function Last()
{
return $this->IsLast();
}

/**
* @return int
*/
Expand Down

0 comments on commit 01173bf

Please sign in to comment.