Import Document Type: use ContentTypeService to search for allowed child nodes if they are not part of the imported type(s)

This commit is contained in:
ChristophNZ
2018-02-22 15:53:11 +10:00
parent accf8ba5f2
commit 0d05d0bf34

View File

@@ -842,10 +842,19 @@ namespace Umbraco.Core.Services
}
else
{
_logger.Warn<PackagingService>(
string.Format(
"Packager: Error handling DocumentType structure. DocumentType with alias '{0}' could not be found and was not added to the structure for '{1}'.",
alias, contentType.Alias));
// DocumentType was not in imported or dependant types, try to get from ContentTypeService
var allowedChild = _contentTypeService.GetContentType(alias);
if (allowedChild == null)
{
_logger.Warn<PackagingService>(
string.Format(
"Packager: Error handling DocumentType structure. DocumentType with alias '{0}' could not be found and was not added to the structure for '{1}'.",
alias, contentType.Alias));
}
if (allowedChildren.Any(x => x.Id.IsValueCreated && x.Id.Value == allowedChild.Id)) continue;
allowedChildren.Add(new ContentTypeSort(new Lazy<int>(() => allowedChild.Id), sortOrder, allowedChild.Alias));
sortOrder++;
}
}