From 24ee246a346868510bbb66f783bda0cfc52e32c6 Mon Sep 17 00:00:00 2001 From: Sergio Navarro Date: Fri, 26 Jun 2015 02:34:08 +0200 Subject: [PATCH] Differentiator is ignored processing placement In placement files shapeType uses "__" intead of '-' char for declaring a differenciator. The point is second one is used only in template files as can be seen in documentation http://docs.orchardproject.net/Documentation/Accessing-and-rendering-shapes#NamingShapesandTemplates However GetShapeType looks for '-' character ignoring placements for a ShapeType with a differentiator. This produces strange behaviors and a lot of headaches to users because when they set for example: in a placement file it forces all Fields_Common_Text shapes within the same Match to be rendered at Header:0 area instead of only affecting those with the SeoTitle differentiator. --- .../ShapePlacementStrategy/ShapePlacementParsingStrategy.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs index 2beb156d3..aff4d6872 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs @@ -111,8 +111,9 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy { differentiator = ""; shapeType = shapeLocation.ShapeType; var dashIndex = shapeType.LastIndexOf('-'); - if (dashIndex > 0 && dashIndex < shapeType.Length - 1) { - differentiator = shapeType.Substring(dashIndex + 1); + var dashIndex = shapeType.LastIndexOf("__"); + if (dashIndex > 0 && dashIndex < shapeType.Length - 2) { + differentiator = shapeType.Substring(dashIndex + 2); shapeType = shapeType.Substring(0, dashIndex); } }