I'm creating a shopping cart for an Orchard CMS site and have created a custom content part (UnpersistedPart) and content type (ShoppingCart).
I've registered the content part to the content type in the custom handler:
Filters.Add(new ActivatingFilter<UnpersistedPart>("ShoppingCart"));
and I've got a view under Views/Parts called Jumpstart.Unpersisted.cshtml.
The view works fine and displays the custom content fine in the front end.
However it is also displaying the same custom content in the Admin panel in the Content List.
Unfortunately the shape tracing tool doesn't work for the Admin panel so I don't know which file to create to override (hide) this content.
A link to any relevant documentation would be great.
The code for the driver:
/// <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.
}