Jump to content

Submenus in admin menu not created or working correctly


Recommended Posts

Hi!

I have an admin module MyModule which is next to Pages, Setup, Modules,... in the main menu. I would like to hang submenu items under it that execute ___executeSubmenu1(), ___executeSubmenu2(), etc.
I have found that it can be done by adding a subpage with e.g. name submenu1, template admin and process MyModule. A submenuitem then appears, but when I select the submenu it still executes ___execute() instead of ___executeSubmenu1(). The crazy thing is that the url ../processwire/mymodule/submenu1/submenu1 (so 2x submenu1) then does execute ___executeSubmenu1().
I also tried using navItems in getModuleInfo(), but I don't see anything from that in the menu.

In between all my attempts I always do an uninstall/install and Modules/Refresh. Unfortunately to no avail.

It's probably a small error on my side, but I just don't see it.... Can anyone give me a little hint to investigate further? I would be very happy with that.

Regards, Douwe.

Link to comment
Share on other sites

Joohoo...! By using 'nav' instead of 'page => 'navItems' in getModuleInfo() i am able to have submenu items! Found this info in wire/core/Process.php. I think chatgpt made up 'navitems' itself 😞 

But why is manually creating a subpage not working?

Regards, Douwe.

Link to comment
Share on other sites

On 4/18/2025 at 6:30 PM, douwe said:

But why is manually creating a subpage not working?

I'm not sure in which cases specifically, but the menu sometimes needs a cookie/cache reset as well. I'm always using Tracy Debugger for that:

QAZ255x.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...