I’m building out a kind of microsite that I want to be able to be plugged in anywhere at any page depth and still work. I’ve got some very important help from @texnixe (as seen here Passing field value/variable to child pages), which is awesome.
The new challenge is figuring out how to get page depth but base it on a specific parent page, so that I can have depth-based settings that work no matter what depth the whole sub-structure is located at. This could possibly build off of the previous thread, which tells me which page I have set as my top-level page for this microsite.
What would be really cool is if I could pass a parent page to $page->depth()
and get the depth below that parent. But that doesn’t seem to currently be a thing.
I can get a count of parent pages with $page->parents()->count()
, but I need a way to stop that at the specific page I’m looking for so I can get depth below that. Any ideas?