mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 19:27:23 +02:00
Flex Pages: Fixed fatal error when trying to move a page to Root (/) [#3161]
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* Sanitize valid Page extensions from `Page::template_format()`
|
||||
* Fixed `bin/gpm index` erroring out [#3158](https://github.com/getgrav/grav/issues/3158)
|
||||
* Fixed `bin/gpm selfupgrade` failing to report failed Grav update [#3116](https://github.com/getgrav/grav/issues/3116)
|
||||
* Flex Pages: Fixed fatal error when trying to move a page to Root (/) [#3161](https://github.com/getgrav/grav/issues/3161)
|
||||
|
||||
# v1.7.0
|
||||
## 01/19/2021
|
||||
|
||||
@@ -372,7 +372,14 @@ class PageObject extends FlexPageObject
|
||||
// If menu item was moved, just make it to be the last in order.
|
||||
if ($isMoved && $this->order() !== false) {
|
||||
$parentKey = $this->getProperty('parent_key');
|
||||
$newParent = $this->getFlexDirectory()->getObject($parentKey, 'storage_key');
|
||||
if ($parentKey === '') {
|
||||
$newParent = $this->getFlexDirectory()->getIndex()->getRoot();
|
||||
} else {
|
||||
$newParent = $this->getFlexDirectory()->getObject($parentKey, 'storage_key');
|
||||
if (!$newParent instanceof PageInterface) {
|
||||
throw new RuntimeException("New parent page '{$parentKey}' not found.");
|
||||
}
|
||||
}
|
||||
$newSiblings = $newParent->children()->getCollection()->withOrdered();
|
||||
$order = 0;
|
||||
foreach ($newSiblings as $sibling) {
|
||||
|
||||
Reference in New Issue
Block a user