我正在为Orchard CMS网站创建购物车,并创建了自定义内容部分(UnpersistedPart)和内容类型(ShoppingCart)。
我已将内容部分注册到自定义处理程序中的内容类型:
Filters.Add(new ActivatingFilter<UnpersistedPart>("ShoppingCart"));
我在Views / Parts下有一个名为Jumpstart.Unpersisted.cshtml的视图。
视图工作正常,并在前端显示自定义内容。
但是,它也在“内容列表”的“管理”面板中显示相同的自定义内容。
不幸的是,形状跟踪工具不适用于管理面板,因此我不知道要创建哪个文件来覆盖(隐藏)此内容。
任何相关文档的链接都会很棒。
驱动程序的代码:
/// <summary>
/// Driver for the UnpersistedPart.
/// Think about drivers as controllers for your parts. They are responsible for UI (display/edit your part).
/// </summary>
public class UnpersistedPartDriver : ContentPartDriver<UnpersistedPart>
{
public Localizer T { get; set; }
private readonly IHttpContextAccessor _httpContextAccessor;
public UnpersistedPartDriver(IHttpContextAccessor httpContextAccessor) {
T = NullLocalizer.Instance;
_httpContextAccessor = httpContextAccessor;
}
/// <summary>
/// This method is responsible for displaying your part in the frontend.
/// </summary>
/// <param name="part">Your part.</param>
/// <param name="displayType"></param>
/// <param name="shapeHelper"></param>
/// <returns></returns>
protected override DriverResult Display(UnpersistedPart part, string displayType, dynamic shapeHelper)
{
return ContentShape("Parts_Jumpstart_Unpersisted",
() => shapeHelper.Parts_Jumpstart_Unpersisted(ContentPart: part));
}
// There is nothing to edit and update, so we don't need Editor methods.
}
答案 0 :(得分:1)
我将此添加到Placement.info:
<Match DisplayType="SummaryAdmin">
<Place Parts_Jumpstart_Unpersisted="-"/>
</Match>
获得了此信息