berechar Posted February 3, 2015 Share Posted February 3, 2015 Hello! I was wondering if it's possible to restrict the selectable pages of a Page Field to the direct children of that page (using a page template containing such a field). What kind of 'selector' would be needed? Something like $page->children()? Kind regards! Link to comment Share on other sites More sharing options...
Soma Posted February 3, 2015 Share Posted February 3, 2015 You can use "page" "parent=page" 1 Link to comment Share on other sites More sharing options...
berechar Posted February 3, 2015 Author Share Posted February 3, 2015 hmm, doesn't work unfortunately, it returns an empty list. Link to comment Share on other sites More sharing options...
adrian Posted February 3, 2015 Share Posted February 3, 2015 Try: parent=page.children EDIT: Bad idea - see below Link to comment Share on other sites More sharing options...
Jan Romero Posted February 3, 2015 Share Posted February 3, 2015 What input type are you using? PageListSelect won’t allow custom selectors or custom PHP code. The Autocomplete input type doesn’t support custom code either. If you put return $page->children; as the custom php, it should totally work. 1 Link to comment Share on other sites More sharing options...
adrian Posted February 3, 2015 Share Posted February 3, 2015 Yeah - I think Jan Romero's way makes more sense. I actually don't know why Soma's suggestion isn't working. My suggestion loads up a bunch of pages but it doesn't really make any sense because it will actually only find the children of the page's children, which basically means all the grandchildren - oops! Link to comment Share on other sites More sharing options...
Soma Posted February 3, 2015 Share Posted February 3, 2015 Ok "page” doesn't work but "page.id" selector: parent=page.id Gives you children of edited page. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now