mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Fixed the first visible child page getting ordering number 999999. [#3365]
This commit is contained in:
parent
7f23b088a4
commit
33be6946f7
|
|
@ -5,7 +5,8 @@
|
|||
* Set `cache.clear_images_by_default` to `false` by default
|
||||
1. [](#bugfix)
|
||||
* Improve Plugin and Theme initialization to fix PHP8 bug [#3368](https://github.com/getgrav/grav/issues/3368)
|
||||
* Fixed `pathinfo()` twig filter in PHP 7
|
||||
* Fixed `pathinfo()` twig filter in PHP7
|
||||
* Fixed the first visible child page getting ordering number `999999.` [#3365](https://github.com/getgrav/grav/issues/3365)
|
||||
|
||||
# v1.7.15
|
||||
## 05/19/2021
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ class PageObject extends FlexPageObject
|
|||
$filesystem = Filesystem::getInstance(false);
|
||||
$oldParentKey = ltrim($filesystem->dirname("/{$storageKey}"), '/');
|
||||
$newParentKey = $this->getProperty('parent_key');
|
||||
$isMoved = $oldParentKey !== $newParentKey;
|
||||
$isMoved = $this->exists() && $oldParentKey !== $newParentKey;
|
||||
$order = !$isMoved ? $this->order() : false;
|
||||
if ($order !== false) {
|
||||
$order = (int)$order;
|
||||
|
|
@ -385,10 +385,12 @@ class PageObject extends FlexPageObject
|
|||
// Handle special case where ordering isn't given.
|
||||
if ($ordering === []) {
|
||||
if ($order >= 999999) {
|
||||
// Set ordering to point to be the last item.
|
||||
// Set ordering to point to be the last item, ignoring the object itself.
|
||||
$order = 0;
|
||||
foreach ($siblings as $sibling) {
|
||||
$order = max($order, (int)$sibling->order());
|
||||
if ($sibling->getKey() !== $this->getKey()) {
|
||||
$order = max($order, (int)$sibling->order());
|
||||
}
|
||||
}
|
||||
$this->order($order + 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user