Adding new menu items to the Admin Menu

As a first step towards building my own module as an add on to Contentbox, I just followed the instructions in the documentation for adding a new admin module to Contentbox. When I get to the part about adding a new menu item it does not work. The docs say:

  • Fired when the module is registered and activated.
    function onLoad(){
    // Let’s add ourselves to the main menu in the Modules section
    var menuService = controller.getWireBox().getInstance( “AdminMenuService@cb” );
    // Add Menu Contribution
    menuService.addSubMenu(topMenu=menuService.MODULES,name=“mySecrets”,label=“my Secrets”,href=“#menuService.buildModuleLink(‘mySecrets’,‘home’)#” );

When I activate my new module the new item does not appear in the Modules menu.

I looked at the code in the AdminMenuService.cfc but I can’t see anything obvious that looks wrong.

Can anyone point me in the right direction please?


Looks to me as if there is a bug here.

I logged the events concerned and the Admin menu creation runs again after the menu item has been added so it it overwritten as it is stored in the variables scope of the singleton component AdminMenuService.

“INFO”,“XNIO-1 task-4”,“09/20/2022”,“18:39:28”,“”,“creating the Admin menu”
“INFO”,“XNIO-1 task-4”,“09/20/2022”,“18:39:28”,“”,“adding mySecrets”
“INFO”,“XNIO-1 task-4”,“09/20/2022”,“18:39:29”,“”,“creating the Admin menu”
“INFO”,“XNIO-1 task-4”,“09/20/2022”,“18:39:39”,“”,“displaying the Admin menu”


I think fixing this is a bit beyond me. I tried simply checking if the menu was already there when init was called and it still suffered the same issue. I conclude that the Wirebox is not treating this as a singleton as it should and returning a second object which never gets updated with the menu items of the add on module.