Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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.
[MenuProvider] public class HandleProjectsMenuProvider : IMenuProvider { private readonly LocalizationService _localizationService; public HandleProjectsMenuProvider(LocalizationService localizationService) { _localizationService = localizationService; } public IEnumerable<MenuItem> GetMenuItems() { var mainMenuItem = new SectionMenuItem("MyPlugin", MenuPaths.Global + "/myplugin") { SortIndex = SortIndex.Last + 100, AuthorizationPolicy = CmsPolicyNames.CmsAdmin }; var logMenuItem = new UrlMenuItem(_localizationService.GetString("/MyPlugin/DisplayName"), MenuPaths.Global + "/myplugin/log", "/MyPlugin/Log/Index") { SortIndex = 100, AuthorizationPolicy = CmsPolicyNames.CmsAdmin }; return new List<MenuItem> { mainMenuItem, logMenuItem }; }
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