Jump to content

Selector Help


Kodikas
 Share

Recommended Posts

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

Edited by Kodikas
Link to comment
Share on other sites

Try "has_parent!=2, include=hidden".

If you only need a selector and not more advanced PHP logic then it's simpler to use the "Selector string" option rather than the "Custom PHP code" option.

image.png.8f5e13f545cbd1c3aa2aaea97cbfc1c3.png

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...