Files
Orchard/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs

30 lines
1.1 KiB
C#
Raw Normal View History

using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Widgets.Models;
using Orchard.Widgets.Services;
namespace Orchard.Widgets.Drivers {
[UsedImplicitly]
public class WidgetPartDriver : ContentPartDriver<WidgetPart> {
private readonly IWidgetsService _widgetsService;
public WidgetPartDriver(IWidgetsService widgetsService) {
_widgetsService = widgetsService;
}
protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) {
widgetPart.AvailableZones = _widgetsService.GetZones();
ContentLocation location = widgetPart.GetLocation("Editor");
return ContentPartTemplate(widgetPart, "Parts/Widgets.WidgetPart").Location(location);
}
protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {
updater.TryUpdateModel(widgetPart, Prefix, null, null);
return Editor(widgetPart, shapeHelper);
}
}
}