AI OnAI Off
I found the solution:
But AuthorizationPoliciy cannot be used then IsAvailble has no effect.
This does not work:
var clearLogMenuItem =
new UrlMenuItem(string.Empty,
MenuPaths.Global + "/myplugin/log/clearlog", "/MyPlugin/Log/ClearLog")
{
IsAvailable = context => false,
SortIndex = 400,
AuthorizationPolicy = CmsPolicyNames.CmsAdmin
};
This does:
var clearLogMenuItem =
new UrlMenuItem(string.Empty,
MenuPaths.Global + "/myplugin/log/clearlog", "/MyPlugin/Log/ClearLog")
{
IsAvailable = context => false,
SortIndex = 400
};
The menu renders but I cannot get the top menu get underlinded after the post and url is /MyPlugin/Log/ClearLog, does anyone know why?
/Kristoffer
Hi!
I have small plugin that displays a log. I have added a new section using the IMenuProvider.
When entering /MyPlugin/Log/Index the menu renders just fine. But in my plugin I have button that clears the log by doing a post to /MyPlugin/Log/ClearLog and after the post the menu does not render?
I guess in some way it is because the logMenuItem points to /Log/Index and /Log/ClearLog is not that url.
How do I make sure the meny always renders for all urls that contains /MyPlugin/Log?
Thanks!
/Kristoffer