include parents as compositions.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
@@ -34,6 +35,10 @@ namespace Umbraco.Core.Models
|
||||
[Obsolete("This method is obsolete, use ContentType(IContentType parent, string alias) instead.", false)]
|
||||
public ContentType(IContentType parent) : this(parent, null)
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.EnableInheritedDocumentTypes)
|
||||
{
|
||||
AddContentType(parent);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -45,6 +50,10 @@ namespace Umbraco.Core.Models
|
||||
public ContentType(IContentType parent, string alias)
|
||||
: base(parent, alias)
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.EnableInheritedDocumentTypes)
|
||||
{
|
||||
AddContentType(parent);
|
||||
}
|
||||
_allowedTemplates = new List<ITemplate>();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
@@ -11,6 +12,7 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using System.Net.Http;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Web.WebApi;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
|
||||
@@ -184,7 +186,18 @@ namespace Umbraco.Web.Editors
|
||||
/// <returns></returns>
|
||||
public ContentTypeDisplay GetEmpty(int parentId)
|
||||
{
|
||||
var ct = new ContentType(parentId);
|
||||
IContentType ct = null;
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.EnableInheritedDocumentTypes &&
|
||||
parentId != Constants.System.Root)
|
||||
{
|
||||
var parent = Services.ContentTypeService.GetContentType(parentId);
|
||||
ct = new ContentType(parent, String.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
ct = new ContentType(parentId);
|
||||
}
|
||||
|
||||
ct.Icon = "icon-document";
|
||||
|
||||
var dto = Mapper.Map<IContentType, ContentTypeDisplay>(ct);
|
||||
|
||||
Reference in New Issue
Block a user