I might just be overlooking something very simple. But I've had enough now so please help.
The following is in my site/ready.php
It returns the pages that should be available to select in a PageReferenceField on the page editor.
$wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) {
if($event->object->hasField == 'localPage') {
$event->return = $event->pages->find('include=hidden');
}
});
Now I just can't get it to return the pages I want: Home, all sub pages and their subs and so on, without also getting all the admin pages.
And yes I looked at https://processwire.com/docs/selectors/#fields