Remove fallback for field specialization

Fallback logic is implied by ordering in placement.info

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-12-10 13:02:54 -08:00
parent e9380fb02f
commit 04f733c34b
2 changed files with 9 additions and 22 deletions

View File

@@ -103,30 +103,13 @@ namespace Orchard.ContentManagement {
ShapeDescriptor descriptor;
if (shapeTable.Descriptors.TryGetValue(partShapeType, out descriptor)) {
ShapePlacementContext placementContext;
string location;
// First, look up placement with differentiator
if (!string.IsNullOrEmpty(differentiator)) {
placementContext = new ShapePlacementContext {
ContentType = context.ContentItem.ContentType,
DisplayType = displayType,
Differentiator = differentiator,
};
location = descriptor.Placement(placementContext);
if (!string.IsNullOrEmpty(location))
return location;
}
// Then fallback to placement without differentiator
placementContext = new ShapePlacementContext {
var placementContext = new ShapePlacementContext {
ContentType = context.ContentItem.ContentType,
DisplayType = displayType,
Differentiator = null,
Differentiator = differentiator,
};
location = descriptor.Placement(placementContext);
if (!string.IsNullOrEmpty(location))
return location;
var location = descriptor.Placement(placementContext);
return location ?? defaultLocation;
}
return defaultLocation;
};

View File

@@ -58,7 +58,11 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
string differentiator;
GetShapeType(shapeLocation, out shapeType, out differentiator);
Func<ShapePlacementContext, bool> predicate = ctx => (ctx.Differentiator ?? "") == differentiator;
Func<ShapePlacementContext, bool> predicate = ctx => true;
if (differentiator != "") {
predicate = ctx => (ctx.Differentiator ?? "") == differentiator;
}
if (matches.Any()) {
predicate = matches.SelectMany(match => match.Terms).Aggregate(predicate, BuildPredicate);
}