mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
To the previous: also caring about the case when ShapePart was dynamically added to the content type/item, see #6360
This commit is contained in:
@@ -28,11 +28,14 @@ namespace Orchard.Templates.Drivers {
|
||||
var contentTypesWithShapePart = _contentManager
|
||||
.GetContentTypeDefinitions()
|
||||
.Where(typeDefinition => typeDefinition.Parts.Any(partDefinition => partDefinition.PartDefinition.Name == "ShapePart"))
|
||||
.Select(typeDefinition => typeDefinition.Name)
|
||||
.ToArray();
|
||||
.Select(typeDefinition => typeDefinition.Name);
|
||||
|
||||
// If ShapePart is only dynamically added to this content type or even this content item then we won't find
|
||||
// a corresponding content type definition, so using the current content type too.
|
||||
contentTypesWithShapePart = contentTypesWithShapePart.Union(new[] { part.ContentItem.ContentType });
|
||||
|
||||
var existingShapeCount = _contentManager
|
||||
.Query(VersionOptions.Latest, contentTypesWithShapePart)
|
||||
.Query(VersionOptions.Latest, contentTypesWithShapePart.ToArray())
|
||||
.Where<TitlePartRecord>(record => record.Title == part.Title && record.ContentItemRecord.Id != part.ContentItem.Id)
|
||||
.Count();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user