Adding FieldDriver.Describe to let content fields expose their storage properties

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-10-20 00:17:13 -07:00
parent 3b137fe0cd
commit 44ec6440c6
9 changed files with 47 additions and 3 deletions

View File

@@ -3,14 +3,17 @@ using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Common.Fields;
using Orchard.Localization;
namespace Orchard.Core.Common.Drivers {
[UsedImplicitly]
public class TextFieldDriver : ContentFieldDriver<TextField> {
public TextFieldDriver(IOrchardServices services) {
Services = services;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
public IOrchardServices Services { get; set; }
private static string GetPrefix(TextField field, ContentPart part) {
@@ -46,5 +49,10 @@ namespace Orchard.Core.Common.Drivers {
protected override void Exporting(ContentPart part, TextField field, ExportContentContext context) {
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Text", field.Value);
}
public override void Describe(DescribeMembersContext context) {
context
.Member(null, typeof(string), T("Value"), T("The text associated with the field."));
}
}
}