Orchard 1.5 在 ContentMenuItem 中添加类或 ID [英] Orchard 1.5 add class or ID in ContentMenuItem

查看:60
本文介绍了Orchard 1.5 在 ContentMenuItem 中添加类或 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Orchard 1.5 添加要为内容菜单项输出的类和/或 ID?

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

推荐答案

转到内容/内容部分",编辑菜单"内容部分并添加CssClass"文本字段.然后,覆盖 menuitem.cshtml 的模板,并在 var tag = 行之后添加:

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);
}

这应该可以解决问题.

这篇关于Orchard 1.5 在 ContentMenuItem 中添加类或 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆