I've implemented a simple menu provider that looks like this:
[MenuProvider]
public class CustomAdminMenuProvider : IMenuProvider
{
public IEnumerable<MenuItem> GetMenuItems() => new List<MenuItem>
{
new SectionMenuItem("Custom Tools", $"{MenuPaths.Global}/cms/admin/customtools"),
new UrlMenuItem("Log Settings", $"{MenuPaths.Global}/cms/admin/customtools/logsettings", "/customadmin/logsettings")
};
}
Behind /customadmin/logsettings is an equally simple Razor page with a PageModel that looks like this:
public class LogSettingsModel : PageModel
{
public LogLevel LogLevel { get; set; }
public void OnGet()
{
LogLevel = SettingsHelper.LogLevel;
}
}
The two menu items specified by the menu provider are displayed as expected, but when I click on the Log Settings menu item, the OnGet() method is called twice. What could I be doing wrong?