From c483da9efe9eab11ac9b62b1b5853f0372438e91 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 29 Jun 2020 15:53:53 -0600 Subject: [PATCH] fix for Page:topParent() Signed-off-by: Andy Miller --- CHANGELOG.md | 1 + system/src/Grav/Common/Page/Page.php | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 783edb64e..3aaddc70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Fixed `Trying to get property 'username' of non-object` error in Flex [flex-objects#62](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/62) * Fixed retina images not working in Flex [flex-objects#64](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/64) * Fixed plugin initialization in CLI + * Fixed broken logic in `Page::topParent()` when dealing with first-level pages # v1.7.0-rc.12 ## 06/08/2020 diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 6a7996d63..1ecb4b0cb 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -2331,11 +2331,7 @@ class Page implements PageInterface */ public function topParent() { - $topParent = $this->parent(); - - if (!$topParent) { - return null; - } + $topParent = $this; while (true) { $theParent = $topParent->parent();