mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19910: Including the field name as part of a field shape alternate.
Work Item: 19910 --HG-- branch : 1.x
This commit is contained in:
@@ -148,39 +148,39 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
|
||||
var shapeType = metadata.Type;
|
||||
var fieldName = differentiator ?? String.Empty;
|
||||
string partName = ctx.ContentPart.PartDefinition.Name;
|
||||
var partName = ctx.ContentPart.PartDefinition.Name;
|
||||
string contentType = shape.ContentItem.ContentType;
|
||||
|
||||
// whether the content type has been created dynamically or not
|
||||
var dynamicType = string.Equals(partName, contentType, StringComparison.Ordinal);
|
||||
var dynamicType = String.Equals(partName, contentType, StringComparison.Ordinal);
|
||||
|
||||
// [ShapeType__FieldName] e.g. Fields/Common.Text-Teaser
|
||||
if ( !string.IsNullOrEmpty(fieldName) )
|
||||
if ( !String.IsNullOrEmpty(fieldName) )
|
||||
metadata.Alternates.Add(shapeType + "__" + EncodeAlternateElement(fieldName));
|
||||
|
||||
// [ShapeType__PartName] e.g. Fields/Common.Text-TeaserPart
|
||||
if ( !string.IsNullOrEmpty(partName) ) {
|
||||
if ( !String.IsNullOrEmpty(partName) ) {
|
||||
metadata.Alternates.Add(shapeType + "__" + EncodeAlternateElement(partName));
|
||||
}
|
||||
|
||||
// [ShapeType]__[ContentType]__[PartName] e.g. Fields/Common.Text-Blog-TeaserPart
|
||||
if ( !string.IsNullOrEmpty(partName) && !string.IsNullOrEmpty(contentType) && !dynamicType ) {
|
||||
if ( !String.IsNullOrEmpty(partName) && !String.IsNullOrEmpty(contentType) && !dynamicType ) {
|
||||
metadata.Alternates.Add(EncodeAlternateElement(shapeType + "__" + contentType + "__" + partName));
|
||||
}
|
||||
|
||||
// [ShapeType]__[PartName]__[FieldName] e.g. Fields/Common.Text-TeaserPart-Teaser
|
||||
if ( !string.IsNullOrEmpty(partName) && !string.IsNullOrEmpty(fieldName) ) {
|
||||
if ( !String.IsNullOrEmpty(partName) && !String.IsNullOrEmpty(fieldName) ) {
|
||||
metadata.Alternates.Add(EncodeAlternateElement(shapeType + "__" + partName + "__" + fieldName));
|
||||
}
|
||||
|
||||
// [ShapeType]__[ContentType]__[FieldName] e.g. Fields/Common.Text-Blog-Teaser
|
||||
if ( !string.IsNullOrEmpty(contentType) && !string.IsNullOrEmpty(fieldName) ) {
|
||||
if ( !String.IsNullOrEmpty(contentType) && !String.IsNullOrEmpty(fieldName) ) {
|
||||
metadata.Alternates.Add(EncodeAlternateElement(shapeType + "__" + contentType + "__" + fieldName));
|
||||
}
|
||||
|
||||
// [ShapeType]__[ContentType]__[PartName]__[FieldName] e.g. Fields/Common.Text-Blog-TeaserPart-Teaser
|
||||
if ( !string.IsNullOrEmpty(contentType) && !string.IsNullOrEmpty(partName) && !string.IsNullOrEmpty(fieldName) && !dynamicType ) {
|
||||
metadata.Alternates.Add(EncodeAlternateElement(shapeType + "__" + contentType + "__" + partName));
|
||||
if ( !String.IsNullOrEmpty(contentType) && !String.IsNullOrEmpty(partName) && !String.IsNullOrEmpty(fieldName) && !dynamicType ) {
|
||||
metadata.Alternates.Add(EncodeAlternateElement(shapeType + "__" + contentType + "__" + partName + "__" + fieldName));
|
||||
}
|
||||
|
||||
return shape;
|
||||
|
Reference in New Issue
Block a user