Removed adding compositions from parents as this breaks core functionality.
Ignoring property in mappings where it isnt needed. Updating the LockedCompositionsResolver to get parent and use path instead of trying to use path which can be null on GetEmpty.
This commit is contained in:
@@ -102,11 +102,6 @@ namespace Umbraco.Core.Models
|
||||
throw new InvalidCompositionException(Alias, contentType.Alias, conflictingPropertyTypeAliases.ToArray());
|
||||
|
||||
_contentTypeComposition.Add(contentType);
|
||||
//Make sure to include the composition's compositions since this is possible with inheritance
|
||||
foreach (var contentTypeComposition in contentType.ContentTypeComposition)
|
||||
{
|
||||
_contentTypeComposition.Add(contentTypeComposition);
|
||||
}
|
||||
OnPropertyChanged(ContentTypeCompositionSelector);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,11 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
return mapping
|
||||
.ForMember(dto => dto.CreateDate, expression => expression.Ignore())
|
||||
.ForMember(dto => dto.UpdateDate, expression => expression.Ignore())
|
||||
.ForMember(dto => dto.UpdateDate, expression => expression.Ignore())
|
||||
.ForMember(dto => dto.ListViewEditorName, expression => expression.Ignore())
|
||||
.ForMember(dto => dto.Notifications, expression => expression.Ignore())
|
||||
.ForMember(dto => dto.Errors, expression => expression.Ignore());
|
||||
.ForMember(dto => dto.Errors, expression => expression.Ignore())
|
||||
.ForMember(dto => dto.LockedCompositeContentTypes, exp => exp.Ignore());
|
||||
}
|
||||
|
||||
public static IMappingExpression<TSource, TDestination> MapBaseContentTypeEntityToDisplay<TSource, TDestination>(
|
||||
|
||||
@@ -17,17 +17,24 @@ namespace Umbraco.Web.Models.Mapping
|
||||
|
||||
protected override IEnumerable<string> ResolveCore(IContentTypeComposition source)
|
||||
{
|
||||
// get ancestor ids from path (exclude current node id)
|
||||
var ancestorIds = source.Path.Substring(0, source.Path.LastIndexOf(',')).Split(',').Select(int.Parse);
|
||||
var aliases = new List<string>();
|
||||
// loop through all content types and return ordered aliases of ancestors
|
||||
var allContentTypes = _applicationContext.Services.ContentTypeService.GetAllContentTypes().ToArray();
|
||||
foreach (var ancestorId in ancestorIds)
|
||||
// get ancestor ids from path of parent if not root
|
||||
if (source.ParentId != Constants.System.Root)
|
||||
{
|
||||
var ancestor = allContentTypes.FirstOrDefault(x => x.Id == ancestorId);
|
||||
if (ancestor != null)
|
||||
var parent = _applicationContext.Services.ContentTypeService.GetContentType(source.ParentId);
|
||||
if (parent != null)
|
||||
{
|
||||
aliases.Add(ancestor.Alias);
|
||||
var ancestorIds = parent.Path.Split(',').Select(int.Parse);
|
||||
// loop through all content types and return ordered aliases of ancestors
|
||||
var allContentTypes = _applicationContext.Services.ContentTypeService.GetAllContentTypes().ToArray();
|
||||
foreach (var ancestorId in ancestorIds)
|
||||
{
|
||||
var ancestor = allContentTypes.FirstOrDefault(x => x.Id == ancestorId);
|
||||
if (ancestor != null)
|
||||
{
|
||||
aliases.Add(ancestor.Alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return aliases.OrderBy(x => x);
|
||||
|
||||
Reference in New Issue
Block a user