I am looking for the best way to interrogate the `aNavigationTabs` Tree to get root + 1 level, with the associated page name and information associated with it. Is there a tools->getPageInfo("/contact") type thing I can use?
For example, if my menu is
Home
About
Contact <-- root + 1 for Chicago page
Jobs
Locations
Helsinki
Chicago <-- Current page
San Francisco
and I'm on the Chicago page, I need to get the page info for Contact; I also need to render a subnav that starts from that level as well.
While on the Chicago page, the subnav would display root+1 and all descendants:
Contact <-- root + 1 for Chicago page
Jobs
Locations
Helsinki
Chicago <-- Current page
San Francisco
I am currently using $this->uri = $request->getPathInfo() in the component actions to pass to the subnav, but that seems hacky...
So I get the path, and then split on / to get the top level page slug to feed a subnav's `$root` option, but that doesn't get me all the info associated with a page and the name. I need to display the 'nice' page name for root+1 when I'm on any descendant page.
Is there a built-in/recommended way to get
- Page path for root+1 on any descendant page?
- Page info for root+1 path? (Mostly need 'nice' name for a particular slug.)
- Both at the same time without $request->getPathInfo() hack?
I'm still studying the code that drives the `aNavigation...` classes to find this stuff and have gotten stuck with too much recursion and memory being used up, just hoping someone could point me in the direction of some magic.
Right now one approach I'm favoring is to get the entire navigation structure to hide/show with css+javascript based on the URI and adding some extra attributes to the nav structure for nice names. I'm still grokking the classes for "ancestor-peer" and the like.
Another approach would be to create separate templates for each top level that I need the nav to start from and simply hard code in $root for each aNavigation component (only 3 of these; not as future proof but in this project apostrophe is acting more as a development speed-up rather than allowing the client to add new pages on their own ad infinitum).
Thanks!
also on SO since I've had trouble posting to this group the past few days: