Manipulate and reload Admin Menu (Alt Admin Theme)

We are looking for a way to manipulate and reload the topnav admin menu without doing a full reinit.

I looked at Preside Documentation :: Configuring admin menu items and the prepare() method looks good, but, it seems it is only executed when doing a reinit. I also tried executing it with a runEvent() command, but, that doesn’t seem to work either.

So my question is: can I reload the menu (or specific topNavItems) without doing a full reload?

Thank you in advance!

The prepare() method should be run each time the menu is rendered. However, you may be running into issues where the top nav is cached per user.

Are you wanting the menu to change from request to request per user? Or are there certain events where clearing the cache would be desirable to ensure new menu items show immediately?

Hey Dom,

well, I want to create individual menu entries per user, and, I would like to clear the cache when specific events occur.

If it’s a caching issue, I guess clearing the cache in an interceptor should work, right?

Thank you!

Yes, exactly:

property name="adminNavMenuCache"  inject="cachebox:adminMenuCache";

// ...
adminNavMenuCache.clearAll();

works prefectly, thank you!

1 Like