Our app has some features that can be turned on or off, and when they’re off we’d like to remove the menu items relating to them. What’s the best way to accomplish this? At what point in the app lifecycle can I get access to the SideMenu
instance and thus modify it via its API?
Hello!
The first way is modifying SideMenu
in the MainScreen
. On InitEvent
menu should be built:
@Autowired
protected SideMenu sideMenu;
@Subscribe
public void onInit(final InitEvent event) {
SideMenu.MenuItem menuItem = sideMenu.getMenuItem("feature");
sideMenu.removeMenuItem(menuItem);
// ...
}
The second way is overriding MenuConfig
bean and adding logic to exclude menus from building process. However, at first glance I don’t see simple extension points in it.