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 8419585
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,22 +1231,28 @@ 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()
{
Deprecation::notice('5.4.0', 'Use IsFirst instead');
return $this->IsFirst();
}

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

public function Last()
{
Deprecation::notice('5.4.0', 'Use IsLast instead');
return $this->IsLast();
}

/**
* @return int
*/
Expand Down

0 comments on commit 8419585

Please sign in to comment.