You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The module currently applies only to pages. When I try to add the Content Permissions Part to menu item (CustomLink or ContentLink), it doesn't affect rendering of the menu. I've tried to find some way how to implement this and extend the module, but can't get to it. Use some filter maybe?
The text was updated successfully, but these errors were encountered:
I had the same concern and had to override the default MenuItem.cshtml view to modify its behaviour.
@inject Etch.OrchardCore.ContentPermissions.Services.IContentPermissionsService ContentPermissionsService
@{
// We are modifiyng the default behaviour to check for permissions
if (!ContentPermissionsService.CanAccess(Model.ContentItem))
{
return;
}
TagBuilder tag = Tag(Model, "li");
// Morphing the shape to keep Model untouched
Model.Metadata.Alternates.Clear();
Model.Classes.Clear();
Model.Metadata.Type = "MenuItemLink";
tag.InnerHtml.AppendHtml(await DisplayAsync(Model));
if ((bool)Model.HasItems)
{
tag.InnerHtml.AppendHtml("<ul>");
foreach (var item in Model.Items)
{
tag.InnerHtml.AppendHtml(await DisplayAsync(item));
}
tag.InnerHtml.AppendHtml("</ul>");
}
}
@tag
The module currently applies only to pages. When I try to add the Content Permissions Part to menu item (CustomLink or ContentLink), it doesn't affect rendering of the menu. I've tried to find some way how to implement this and extend the module, but can't get to it. Use some filter maybe?
The text was updated successfully, but these errors were encountered: