From 04f733c34b71a1d190f6a1f461b4b259a74ddfd6 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Fri, 10 Dec 2010 13:02:54 -0800 Subject: [PATCH] Remove fallback for field specialization Fallback logic is implied by ordering in placement.info --HG-- branch : dev --- .../DefaultContentDisplay.cs | 25 +++---------------- .../ShapePlacementParsingStrategy.cs | 6 ++++- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/Orchard/ContentManagement/DefaultContentDisplay.cs b/src/Orchard/ContentManagement/DefaultContentDisplay.cs index 44ee2fe89..cb03ce034 100644 --- a/src/Orchard/ContentManagement/DefaultContentDisplay.cs +++ b/src/Orchard/ContentManagement/DefaultContentDisplay.cs @@ -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; }; diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs index 36708f0be..b7761a785 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs @@ -58,7 +58,11 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy { string differentiator; GetShapeType(shapeLocation, out shapeType, out differentiator); - Func predicate = ctx => (ctx.Differentiator ?? "") == differentiator; + Func predicate = ctx => true; + if (differentiator != "") { + predicate = ctx => (ctx.Differentiator ?? "") == differentiator; + } + if (matches.Any()) { predicate = matches.SelectMany(match => match.Terms).Aggregate(predicate, BuildPredicate); }