processwire / processwire-requests

ProcessWire feature requests.
40 stars 0 forks source link

Allow Process modules to set child nav items dynamically #189

Open Toutouwai opened 6 years ago

Toutouwai commented 6 years ago

Short description of the enhancement

Process modules can define child nav items using the nav element of getModuleInfo() (example in ProcessModule). But this is not as useful as it could be because getModuleInfo() is a static method so there is no ability to define nav items dynamically, depending on the saved module config or in a hookable method for instance.

It is possible to define the navigation dynamically for the next level down because that is set in executeNavJSON() which is called via AJAX. But that isn't always an adequate solution - you end up having to create some unnecessary/awkward nav item in getModuleInfo() just so you can use executeNavJSON() for the real nav items. And it is also problematic if you want to conditionally show either some or zero nav items.

I expect it wouldn't be a trivial change to allow dynamic nav child items for Process modules as I think that first level is cached currently. But it would be much more flexible and useful if those items could be set dynamically.

Toutouwai commented 6 years ago

Some extra clarification:

It seems you can use executeNavJSON() for the first level of child items so long as the page for the Process module is not a direct child of Admin (i.e. the page is a subpage of Pages, Setup, etc). But this doesn't work if the Process module page is a direct child of Admin (i.e. appears in the admin masthead). Could something be done to allow executeNavJSON() to work in these circumstances?

adrianbj commented 4 years ago

@ryancramerdesign - this would be really useful please - it's strange to me that you can use executeNavJSON() if the page is a child of Setup or similar, but not if it's a direct child of the main Admin page.

BernhardBaumrock commented 2 years ago

This issue is still a huge limitation for me :( Any chance to get this implemented @ryancramerdesign ?