mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Changing the ShapeAlterationBuilder to collapse shapes together by base name
ShapeType and BindingName are treated as two strings Shorter string broken at first delimiter is used as registered ShapeType name All alterations of the same ShapeType are accumulated into the same ShapeDescriptor --HG-- branch : theming
This commit is contained in:
@@ -7,13 +7,22 @@ using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.DisplayManagement.Descriptors {
|
||||
public class ShapeAlterationBuilder {
|
||||
protected Feature _feature;
|
||||
protected string _shapeType;
|
||||
protected readonly IList<Action<ShapeDescriptor>> _configurations = new List<Action<ShapeDescriptor>>();
|
||||
Feature _feature;
|
||||
readonly string _shapeType;
|
||||
readonly string _bindingName;
|
||||
readonly IList<Action<ShapeDescriptor>> _configurations = new List<Action<ShapeDescriptor>>();
|
||||
|
||||
public ShapeAlterationBuilder(Feature feature, string shapeType) {
|
||||
_feature = feature;
|
||||
_shapeType = shapeType;
|
||||
_bindingName = shapeType;
|
||||
var delimiterIndex = shapeType.IndexOf("__");
|
||||
|
||||
if (delimiterIndex < 0) {
|
||||
_shapeType = shapeType;
|
||||
}
|
||||
else {
|
||||
_shapeType = shapeType.Substring(0, delimiterIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public ShapeAlterationBuilder From(Feature feature) {
|
||||
@@ -33,7 +42,7 @@ namespace Orchard.DisplayManagement.Descriptors {
|
||||
Func<DisplayContext, IHtmlString> target = null;
|
||||
|
||||
var binding = new ShapeBinding {
|
||||
BindingName = _shapeType,
|
||||
BindingName = _bindingName,
|
||||
BindingSource = bindingSource,
|
||||
Binding = displayContext => {
|
||||
|
||||
|
Reference in New Issue
Block a user