Open Karmalakas opened 3 years ago
Yup. I have no idea why it does that, but I did add PageCollectionInterface
into the return values because it did that for some crazy reason.
CC @rhukster
FYI, I'm already creating a PR for this 😉
I don't think it will be accepted as I'm pretty sure there was a reason why I didn't fix that.
Still created 🙂 Maybe it'll be a jump-start for Grav team to investigate this
I checked Flex Pages collections and it already has this behavior. Though it's not really being used, but... I must have been thinking about changing the behavior already.
Yes, elsewhere it's fine. That's why I'm leaning towards fixing page collection too.
Hi, any progress here? I am facing the same issue as @Karmalakas and it is quite annoying. Is there any correct (simple or straightforward) way to get page siblings?
For me, it looks like it is broken, or I am wrong? Or I don't get something important?
Edited: Sorry, bad output during debugging - collections and children itself are ok.
/system/src/Grav/Common/Page/Collection.php::adjacentSibling() may return back the whole Collection if previous or next sibling is not found. All other places in such case expect to return
false
. system/src/Grav/Common/Page/Interfaces/PageCollectionInterface.php::adjacentSibling() defines return typesPageInterface|PageCollectionInterface|false
, butPageCollectionInterface
should not be there as no other method expects to return it. Also naming suggests aPageInterface
if found or empty value (null|false
) to be returned if not found, but not a collection