diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
index cb4463fa6f..083e8dcc6e 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
@@ -20,7 +20,7 @@ namespace Umbraco.Core.Models.PublishedContent
/// Initializes a new instance of the class with a content type.
///
public PublishedContentType(IContentTypeComposition contentType, IPublishedContentTypeFactory factory)
- : this(contentType.Id, contentType.Alias, contentType.GetItemType(), contentType.CompositionAliases(), contentType.Variations)
+ : this(contentType.Id, contentType.Alias, contentType.GetItemType(), contentType.CompositionAliases(), contentType.Variations, contentType.IsElement)
{
var propertyTypes = contentType.CompositionPropertyTypes
.Select(x => factory.CreatePropertyType(this, x))
@@ -31,8 +31,6 @@ namespace Umbraco.Core.Models.PublishedContent
_propertyTypes = propertyTypes.ToArray();
- IsElement = contentType.IsElement;
-
InitializeIndexes();
}
@@ -43,8 +41,8 @@ namespace Umbraco.Core.Models.PublishedContent
/// This constructor is for tests and is not intended to be used directly from application code.
/// Values are assumed to be consisted and are not checked.
///
- public PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, IEnumerable propertyTypes, ContentVariation variations)
- : this (id, alias, itemType, compositionAliases, variations)
+ public PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, IEnumerable propertyTypes, ContentVariation variations, bool isElement = false)
+ : this (id, alias, itemType, compositionAliases, variations, isElement)
{
var propertyTypesA = propertyTypes.ToArray();
foreach (var propertyType in propertyTypesA)
@@ -54,13 +52,14 @@ namespace Umbraco.Core.Models.PublishedContent
InitializeIndexes();
}
- private PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, ContentVariation variations)
+ private PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, ContentVariation variations, bool isElement)
{
Id = id;
Alias = alias;
ItemType = itemType;
CompositionAliases = new HashSet(compositionAliases, StringComparer.InvariantCultureIgnoreCase);
Variations = variations;
+ IsElement = isElement;
}
private void InitializeIndexes()
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeFactory.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeFactory.cs
index efb39ba844..abf4156d7f 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeFactory.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeFactory.cs
@@ -32,15 +32,15 @@ namespace Umbraco.Core.Models.PublishedContent
}
// for tests
- internal PublishedContentType CreateContentType(int id, string alias, IEnumerable propertyTypes, ContentVariation variations = ContentVariation.Nothing)
+ internal PublishedContentType CreateContentType(int id, string alias, IEnumerable propertyTypes, ContentVariation variations = ContentVariation.Nothing, bool isElement = false)
{
- return new PublishedContentType(id, alias, PublishedItemType.Content, Enumerable.Empty(), propertyTypes, variations);
+ return new PublishedContentType(id, alias, PublishedItemType.Content, Enumerable.Empty(), propertyTypes, variations, isElement);
}
// for tests
- internal PublishedContentType CreateContentType(int id, string alias, IEnumerable compositionAliases, IEnumerable propertyTypes, ContentVariation variations = ContentVariation.Nothing)
+ internal PublishedContentType CreateContentType(int id, string alias, IEnumerable compositionAliases, IEnumerable propertyTypes, ContentVariation variations = ContentVariation.Nothing, bool isElement = false)
{
- return new PublishedContentType(id, alias, PublishedItemType.Content, compositionAliases, propertyTypes, variations);
+ return new PublishedContentType(id, alias, PublishedItemType.Content, compositionAliases, propertyTypes, variations, isElement);
}
///
diff --git a/src/Umbraco.Tests/Published/NestedContentTests.cs b/src/Umbraco.Tests/Published/NestedContentTests.cs
index fc1b4d8f3c..b5d6182c28 100644
--- a/src/Umbraco.Tests/Published/NestedContentTests.cs
+++ b/src/Umbraco.Tests/Published/NestedContentTests.cs
@@ -11,7 +11,6 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
-using Umbraco.Core.Services;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
using Umbraco.Web.Models;
@@ -132,7 +131,7 @@ namespace Umbraco.Tests.Published
var contentType1 = factory.CreateContentType(1, "content1", new[] { propertyType1 });
var contentType2 = factory.CreateContentType(2, "content2", new[] { propertyType2 });
- var contentTypeN1 = factory.CreateContentType(2, "contentN1", new[] { propertyTypeN1 });
+ var contentTypeN1 = factory.CreateContentType(2, "contentN1", new[] { propertyTypeN1 }, isElement: true);
// mocked content cache returns content types
contentCache