Orchard 1.5 add class or ID in ContentMenuItem

喜欢而已 提交于 2019-12-06 06:30:07

问题


How can I add a class and/or ID to be output for a Content Menu Item with Orchard 1.5?


回答1:


Go to Content/Content Parts, edit the Menu content part and add a "CssClass" text field. Then, override the template for menuitem.cshtml and right after the var tag = line, add:

if (Model.CssClass != null) {
    tag.AddCssClass(Model.ContentItem.Menu.CssClass.Value);
}

That should do the trick.



来源:https://stackoverflow.com/questions/12109728/orchard-1-5-add-class-or-id-in-contentmenuitem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!