mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 13:18:25 +08:00
Create Display/Editor location settings for Parts and Fields
--HG-- branch : dev
This commit is contained in:
parent
cda6ae3d06
commit
6b271f8f54
@ -2,6 +2,7 @@
|
|||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Drivers;
|
using Orchard.ContentManagement.Drivers;
|
||||||
using Orchard.Core.Common.Fields;
|
using Orchard.Core.Common.Fields;
|
||||||
|
using Orchard.Core.Common.Settings;
|
||||||
|
|
||||||
namespace Orchard.Core.Common.Drivers {
|
namespace Orchard.Core.Common.Drivers {
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
@ -18,11 +19,21 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Display(ContentPart part, TextField field, string displayType) {
|
protected override DriverResult Display(ContentPart part, TextField field, string displayType) {
|
||||||
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part));
|
var locationSettings =
|
||||||
|
field.PartFieldDefinition.Settings.GetModel<LocationSettings>("DisplayLocation") ??
|
||||||
|
new LocationSettings { Zone = "primary", Position = "5" };
|
||||||
|
|
||||||
|
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
|
||||||
|
.Location(locationSettings.Zone, locationSettings.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(ContentPart part, TextField field) {
|
protected override DriverResult Editor(ContentPart part, TextField field) {
|
||||||
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part)).Location("primary", "5");
|
var locationSettings =
|
||||||
|
field.PartFieldDefinition.Settings.GetModel<LocationSettings>("EditorLocation") ??
|
||||||
|
new LocationSettings { Zone = "primary", Position = "5" };
|
||||||
|
|
||||||
|
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
|
||||||
|
.Location(locationSettings.Zone, locationSettings.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater) {
|
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater) {
|
||||||
|
Loading…
Reference in New Issue
Block a user