joer80 Posted February 17, 2017 Share Posted February 17, 2017 When creating a page field that uses Custom PHP code to find selectable pages , the example shows this: Return $page->parent->parent->children("name=locations")->first()->children(); It seems this only works if your page is at a specific depth in the page tree that matches the number of parent-> listed here. If you move the page up a level or down a level, the select will break. Is there a way to return a page array without a specified depth? Link to comment Share on other sites More sharing options...
kongondo Posted February 17, 2017 Share Posted February 17, 2017 (edited) Not a good idea though without limits...can easily overwhelm the server if lots of descendants: return $page->find('');// will find all descendants Edited February 17, 2017 by kongondo Link to comment Share on other sites More sharing options...
joer80 Posted February 17, 2017 Author Share Posted February 17, 2017 I think I found the answer.. Instead of using page, you just use pages. It can be at any depth. return $pages->find('parent='/pathofparent/'); 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