I could not find any other topic about this issue, so here we go.
Let's assume the following use case. We have a collaboration tool where you can add portals (a workspace). You can add documents to a portal. A document is a node with some CCK fields.
Example:
The following paths are defined in a custom module with the hook_menu hook. We don't use Views for the overviews and we don't want to.
/portal/% = Portal Frontpage
/portal/%/documents = Portal Documents overview
/portal/%/documents/% = Portal Document Detail View
/portal/%/documents/add = Add a new document to the portal
/portal/%/documents/%/edit = Edit page of the portal document
Ok, everything works but we are NOT happy how Drupal is building the menu.
ISSUE 1:
First example works great:
When I access /portal/%/documents
Title: Portal Name
Nav Level 1: Documents[active], Tool_X, Tool_Y
Nav Level 2: Overview[active], Add document
Content: show document overview
But when I access /portal/%/documents/% the menu is not built correctly. We could not manage to create a menu like:
Title: Portal Name
Nav Level 1: Documents[active], Tool_X, Tool_Y
Nav Level 2: Overview, Add document
Content: node detail view
The problem is, that when I access the node detail view it looses the menu trail which is bad for the user experience.
When I access /portal/%/documents/%/add or /portal/%/documents/%/edit we also have problems to create a meaningfull menu. It should keep the context of the portal for usability reasons.
Issue 2:
Let's assume I want to create more functionality under /portal/%/documents/ eg. /portal/%/documents/collections. Tasks for the collections tool are /portal/%/documents/collections/add, /portal/%/documents/collections/edit, /portal/%/documents/collections/%. The tool is meant to create document collections.
When accessing /portal/%/documents/collections I would like to have a following menu:
Title: Portal Name
Nav Level 1: Documents[active], Tool_X, Tool_Y
Nav Level 2: Overview, Add document, Collection[active]
Nav Level 3: Overview[active], Add Collection
Content: Show all available collections
My question here is: How can I add a third navigation level with hook_menu? And I want to have similar functionality as described in ISSUE 1 (detail view with correct active menu).
If you encountered the same problem, I'm highly interested in your solution. Until now, we made "hacks" but they all do not really work as we want.
Thanks for any hint or advice.
All the best
Lukas