mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Remove fallback for field specialization
Fallback logic is implied by ordering in placement.info --HG-- branch : dev
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user