Builds each user's menu tree, merging what every installed app contributes with the account's saved menu customisations. Covers both the admin console navigation and a website's front end menu, contributed to by every installed app and then customised from the account's saved menu.json. Exposed to Velocity templates as menuManager, and used by the HTML template renderers to resolve the root menu item for the current profile and root folder. Caches the built tree briefly per organisation, root folder and profile, and drops the relevant cache entries whenever an app is enabled, disabled or installed, or a profile's own menu customisation changes. For the admin console it also owns the fixed top level sections, grouping and pruning contributed items into them once every app has run.


Properties

PropertyReturnsDescription
rootMenuItemMenuItemRoot menu item for the currently authenticated profile and the current request's root folder, resolved from the request context. Built once per organisation, root folder and profile and cached briefly, so repeated calls in the same request are cheap after the first.

Methods

getRootMenuItem()

Returns: MenuItem

Root menu item for the currently authenticated profile and the current request's root folder, resolved from the request context. Built once per organisation, root folder and profile and cached briefly, so repeated calls in the same request are cheap after the first.

getRootMenuItem(Resource r, Profile user, RootFolder rootFolder)

Returns: MenuItem

Root menu item for the given resource, user and root folder, building it from every active menu application if it is not already cached. The finished tree is cached briefly per organisation, root folder and profile, and is also stashed as an attribute on the root folder for older code that still reads it from there.

ParameterDescription
rthe resource the menu is being resolved for
userthe profile the menu is built for, or null for an anonymous visitor
rootFolderthe account and site whose menu applications and configuration are used to build the tree

invalidateRootMenuItemCache(Profile user, RootFolder rootFolder)

Returns: void

Drop the cached root menu item for one profile's view of one root folder, so it is rebuilt on next use. Use this when only that profile's own menu customisation changes; for an account wide change such as an app being enabled, disabled or installed use invalidateRootMenuItemCache(Organisation) instead.

ParameterDescription
userthe profile whose cached menu is dropped, or null to target the anonymous visitor's cached menu
rootFolderthe root folder whose cached menu is dropped; the call does nothing when this is null

invalidateRootMenuItemCache(Organisation organisation)

Returns: void

Drop every cached admin menu belonging to the given organisation, for all of its users. Use this when something changes the menu account wide, such as an app being enabled, disabled or installed. Unlike invalidateRootMenuItemCache(Profile, RootFolder) this does not need a current request, so it also works from background jobs.

ParameterDescription
organisationthe account whose menus should be rebuilt on next use. Ignored when null, or when it has no org id to key on
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.