Working with menus
Menus are rendered by the current theme, so the final application or modules can't directly change the menu items. You can see the main menu on the left-hand side of Figure 12.1. ABP provides a menu system, so the modules and the final application can dynamically add new menu items or remove/change the items that are added by those modules.
We can use AbpNavigationOptions
to add contributors to the menu system. ABP executes all the contributors to build the menu dynamically, as shown in the following example:
Configure<AbpNavigationOptions>(options => { options.MenuContributors.Add(new MyMenuContributor()); });
Here, MyMenuContributor
should be a class that implements the IMenuContributor
interface. The ABP startup solution template already contains a menu contributor class that you can directly use. IMenuContributor
defines the ConfigureMenuAsync
method, which we should implement like so:
public class MvcDemoMenuContributor...