Files
Orchard/src/Orchard.Web/Core/Containers/Drivers/ContainerPartDriver.cs

29 lines
1.1 KiB
C#
Raw Normal View History

using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Containers.Models;
using Orchard.Data;
namespace Orchard.Core.Containers.Drivers {
public class ContainerPartDriver : ContentPartDriver<ContainerPart> {
protected override DriverResult Editor(ContainerPart part, dynamic shapeHelper) {
return Editor(part, null, shapeHelper);
}
protected override DriverResult Editor(ContainerPart part, ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
return ContentShape(
"Parts_Container_Edit",
() => {
if (updater != null)
updater.TryUpdateModel(part, "Container", null, null);
return shapeHelper.EditorTemplate(TemplateName: "Container", Model: part, Prefix: "Container");
});
}
}
public class ContainerPartHandler : ContentHandler {
public ContainerPartHandler(IRepository<ContainerPartRecord> repository) {
Filters.Add(StorageFilter.For(repository));
}
}
}