Class PublishedContentType
Represents an IPublishedElement type.
Inheritance
Namespace: Umbraco.Cms.Core.Models.PublishedContent
Assembly: Umbraco.Core.dll
Syntax
public class PublishedContentType : IPublishedContentType
Remarks
Instances of the PublishedContentType class are immutable, ie if the content type changes, then a new class needs to be created.
Constructors
View SourcePublishedContentType(Guid, Int32, String, PublishedItemType, IEnumerable<String>, Func<IPublishedContentType, IEnumerable<IPublishedPropertyType>>, ContentVariation, Boolean)
This constructor is for tests and is not intended to be used directly from application code.
Declaration
public PublishedContentType(Guid key, int id, string alias, PublishedItemType itemType, IEnumerable<string> compositionAliases, Func<IPublishedContentType, IEnumerable<IPublishedPropertyType>> propertyTypes, ContentVariation variations, bool isElement = false)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | |
System.Int32 | id | |
System.String | alias | |
PublishedItemType | itemType | |
IEnumerable<System.String> | compositionAliases | |
Func<IPublishedContentType, IEnumerable<IPublishedPropertyType>> | propertyTypes | |
ContentVariation | variations | |
System.Boolean | isElement |
Remarks
Values are assumed to be consistent and are not checked.
PublishedContentType(Guid, Int32, String, PublishedItemType, IEnumerable<String>, IEnumerable<PublishedPropertyType>, ContentVariation, Boolean)
This constructor is for tests and is not intended to be used directly from application code.
Declaration
public PublishedContentType(Guid key, int id, string alias, PublishedItemType itemType, IEnumerable<string> compositionAliases, IEnumerable<PublishedPropertyType> propertyTypes, ContentVariation variations, bool isElement = false)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | |
System.Int32 | id | |
System.String | alias | |
PublishedItemType | itemType | |
IEnumerable<System.String> | compositionAliases | |
IEnumerable<PublishedPropertyType> | propertyTypes | |
ContentVariation | variations | |
System.Boolean | isElement |
Remarks
Values are assumed to be consistent and are not checked.
PublishedContentType(Int32, String, PublishedItemType, IEnumerable<String>, Func<IPublishedContentType, IEnumerable<IPublishedPropertyType>>, ContentVariation, Boolean)
Declaration
public PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable<string> compositionAliases, Func<IPublishedContentType, IEnumerable<IPublishedPropertyType>> propertyTypes, ContentVariation variations, bool isElement = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
System.String | alias | |
PublishedItemType | itemType | |
IEnumerable<System.String> | compositionAliases | |
Func<IPublishedContentType, IEnumerable<IPublishedPropertyType>> | propertyTypes | |
ContentVariation | variations | |
System.Boolean | isElement |
PublishedContentType(Int32, String, PublishedItemType, IEnumerable<String>, IEnumerable<PublishedPropertyType>, ContentVariation, Boolean)
Declaration
public PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable<string> compositionAliases, IEnumerable<PublishedPropertyType> propertyTypes, ContentVariation variations, bool isElement = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
System.String | alias | |
PublishedItemType | itemType | |
IEnumerable<System.String> | compositionAliases | |
IEnumerable<PublishedPropertyType> | propertyTypes | |
ContentVariation | variations | |
System.Boolean | isElement |
PublishedContentType(IContentTypeComposition, IPublishedContentTypeFactory)
Initializes a new instance of the PublishedContentType class with a content type.
Declaration
public PublishedContentType(IContentTypeComposition contentType, IPublishedContentTypeFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeComposition | contentType | |
IPublishedContentTypeFactory | factory |
Properties
View SourceAlias
Gets the content type alias.
Declaration
public string Alias { get; }
Property Value
Type | Description |
---|---|
System.String |
CompositionAliases
Gets the aliases of the content types participating in the composition.
Declaration
public HashSet<string> CompositionAliases { get; }
Property Value
Type | Description |
---|---|
HashSet<System.String> |
Id
Gets the content type identifier.
Declaration
public int Id { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsElement
Gets a value indicating whether this content type is for an element.
Declaration
public bool IsElement { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ItemType
Gets the content item type.
Declaration
public PublishedItemType ItemType { get; }
Property Value
Type | Description |
---|---|
PublishedItemType |
Key
Gets the unique key for the content type.
Declaration
public Guid Key { get; }
Property Value
Type | Description |
---|---|
Guid |
PropertyTypes
Gets the content type properties.
Declaration
public IEnumerable<IPublishedPropertyType> PropertyTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IPublishedPropertyType> |
Variations
Gets the content variations of the content type.
Declaration
public ContentVariation Variations { get; }
Property Value
Type | Description |
---|---|
ContentVariation |
Methods
View SourceGetPropertyIndex(String)
Gets a property type index.
Declaration
public int GetPropertyIndex(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias |
Returns
Type | Description |
---|---|
System.Int32 |
Remarks
The alias is case-insensitive. This is the only place where alias strings are compared.
GetPropertyType(Int32)
Gets a property type.
Declaration
public virtual IPublishedPropertyType GetPropertyType(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type | Description |
---|---|
IPublishedPropertyType |
GetPropertyType(String)
Gets a property type.
Declaration
public virtual IPublishedPropertyType GetPropertyType(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias |
Returns
Type | Description |
---|---|
IPublishedPropertyType |