mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 04:43:35 +08:00
Field template alternates based on field name and content part/type name
When a ContentShape is returned from a ContentFieldDriver alternates are added automatically Patterns include: ShapeName ShapeName__FieldName ShapeName__PartName ShapeName__FieldName__PartName For content fields the part name is, essentially, always the same as the content type name Field drivers must add a ContentPart property to the shape they return, or only the field name will be a valid alternate Updated TextFieldDriver Fixed a bug where a dash after a dot in a file name was preventing proper harvesting --HG-- branch : dev extra : rebase_source : cae3d8cf544628b5f35cfc584ebbedf4d505c8ce
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
protected override DriverResult Display(ContentPart part, TextField field, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Common_Text", GetDifferentiator(field, part),
|
||||
() => shapeHelper.Fields_Common_Text(ContentField: field, Name: field.Name, Value: field.Value));
|
||||
() => shapeHelper.Fields_Common_Text(ContentPart: part, ContentField: field, Name: field.Name, Value: field.Value));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) {
|
||||
|
@@ -20,11 +20,6 @@ namespace Orchard.Core.Common {
|
||||
string flavor = displaying.Shape.EditorFlavor;
|
||||
displaying.ShapeMetadata.Alternates.Add("Body_Editor__" + flavor);
|
||||
});
|
||||
builder.Describe("Fields_Common_Text")
|
||||
.OnDisplaying(displaying => {
|
||||
string textFieldName = displaying.Shape.Name;
|
||||
displaying.ShapeMetadata.Alternates.Add("Fields_Common_Text__" + textFieldName);
|
||||
});
|
||||
}
|
||||
|
||||
[Shape]
|
||||
|
Reference in New Issue
Block a user