I receive a Pages Collection $collection containing those three pages. This works fine with pages of status listed or unlisted, but not with drafts; if the IDs in $pages are for pages of draft status, I receive this error:
Kirby\Exception\InvalidArgumentException thrown with message “You must pass a Page object to the Pages collection”
Is there a way to create a pages collection from a set of IDs, while those are drafts?
I tried the factory as well but I could not yet figure out a way to hand it an array of IDs. After a bit of reconsideration, I did achieve what I wanted with the following approach:
$collection = new Pages();
foreach ($pages as $page) {
$collection->add(kirby()->page($page));
}
Remains to be seen how this performs, but for now it appears a viable solution …and I learned that new Pages() seemingly has the same limitation as the page() helper, to only cover listed and unlisted pages.