mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
} |