#18911: Making wrappers normal shapes with alternates, lifetime events etc.

Work Item: 18911
This commit is contained in:
Piotr Szmyd
2013-11-03 21:33:56 +01:00
parent 8fb93a8ecb
commit f567eb0ec4

View File

@@ -92,13 +92,30 @@ namespace Orchard.DisplayManagement.Implementation {
}
}
foreach (var frameType in shape.Metadata.Wrappers) {
ShapeBinding frameBinding;
if (TryGetDescriptorBinding(frameType, Enumerable.Empty<string>(), shapeTable, out frameBinding)) {
shape.Metadata.ChildContent = Process(frameBinding, shape, context);
}
var wrappers = shape.Metadata.Wrappers;
var alternates = shape.Metadata.Alternates;
foreach (var wrapperType in wrappers) {
// clearing wrappers and alternates to prevent infinite loop
shape.Metadata.Wrappers = new List<string>();
shape.Metadata.Alternates = new List<string>();
// mutating current shape to the wrapper type, leaving all content unchanged
// (wrapper will have the same model as main template)
shape.Metadata.Type = wrapperType;
var newContext = new DisplayContext {
Display = context.Display,
Value = shape,
ViewContext = context.ViewContext,
ViewDataContainer = context.ViewDataContainer
};
shape.Metadata.ChildContent = Execute(newContext);
}
shape.Metadata.Wrappers = wrappers;
shape.Metadata.Alternates = alternates;
var displayedContext = new ShapeDisplayedContext {
Shape = shape,
ShapeMetadata = shape.Metadata,