mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 13:38:22 +01:00
Fix PageCollection::sort()
using id
as default property, returning as adjacent pages in completely different places within hierarchy
This commit is contained in:
parent
0992ff4e4f
commit
ae222d2de3
@ -9,6 +9,13 @@ use Formwork\Utils\Str;
|
||||
|
||||
class PageCollection extends Collection
|
||||
{
|
||||
/**
|
||||
* Default property used to sort pages
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected const DEFAULT_SORT_PROPERTY = 'relativePath';
|
||||
|
||||
/**
|
||||
* Pagination related to the collection
|
||||
*
|
||||
@ -111,7 +118,7 @@ class PageCollection extends Collection
|
||||
*
|
||||
* @param int|string $direction Sorting direction (SORT_ASC or 1 for ascending order, SORT_DESC or -1 for descending)
|
||||
*/
|
||||
public function sort(string $property = 'id', $direction = SORT_ASC): self
|
||||
public function sort(string $property = self::DEFAULT_SORT_PROPERTY, $direction = SORT_ASC): self
|
||||
{
|
||||
$pageCollection = clone $this;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user