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: <Place Fields_Common_Text__SeoTitle="/Header:0"/>  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.
This commit is contained in:
Sergio Navarro
2015-06-26 02:34:08 +02:00
parent f3fc2b53ba
commit 24ee246a34

View File

@@ -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);
}
}