Interface IPublishedContent
Represents a published content item.
Namespace: Umbraco.Cms.Core.Models.PublishedContent
Assembly: Umbraco.Core.dll
Syntax
public interface IPublishedContent : IPublishedElement
Remarks
Can be a published document, media or member.
Properties
View SourceChildren
Gets the children of the content item that are available for the current culture.
Declaration
IEnumerable<IPublishedContent>? Children { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IEnumerable<IPublishedContent>> |
ChildrenForAllCultures
Gets all the children of the content item, regardless of whether they are available for the current culture.
Declaration
IEnumerable<IPublishedContent>? ChildrenForAllCultures { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IEnumerable<IPublishedContent>> |
CreateDate
Gets the date the content item was created.
Declaration
DateTime CreateDate { get; }
Property Value
Type | Description |
---|---|
DateTime |
CreatorId
Gets the identifier of the user who created the content item.
Declaration
int CreatorId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Cultures
Gets available culture infos.
Declaration
IReadOnlyDictionary<string, PublishedCultureInfo> Cultures { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<System.String, PublishedCultureInfo> |
Remarks
Contains only those culture that are available. For a published content, these are the cultures that are published. For a draft content, those that are 'available' ie have a non-empty content name.
Does not contain the invariant culture.
// fixme?Id
Gets the unique identifier of the content item.
Declaration
int Id { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ItemType
Gets the type of the content item (document, media...).
Declaration
PublishedItemType ItemType { get; }
Property Value
Type | Description |
---|---|
PublishedItemType |
Level
Gets the tree level of the content item.
Declaration
int Level { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
Gets the name of the content item for the current culture.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Parent
Gets the parent of the content item.
Declaration
IPublishedContent Parent { get; }
Property Value
Type | Description |
---|---|
IPublishedContent |
Remarks
The parent of root content is null
.
Path
Gets the tree path of the content item.
Declaration
string Path { get; }
Property Value
Type | Description |
---|---|
System.String |
SortOrder
Gets the sort order of the content item.
Declaration
int SortOrder { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TemplateId
Gets the identifier of the template to use to render the content item.
Declaration
int? TemplateId { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
UpdateDate
Gets the date the content item was last updated.
Declaration
DateTime UpdateDate { get; }
Property Value
Type | Description |
---|---|
DateTime |
Remarks
For published content items, this is also the date the item was published.
This date is always global to the content item, see CultureDate() for the date each culture was published.
UrlSegment
Gets the URL segment of the content item for the current culture.
Declaration
string UrlSegment { get; }
Property Value
Type | Description |
---|---|
System.String |
WriterId
Gets the identifier of the user who last updated the content item.
Declaration
int WriterId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
View SourceIsDraft(String)
Gets a value indicating whether the content is draft.
Declaration
bool IsDraft(string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
A content is draft when it is the unpublished version of a content, which may have a published version, or not.
When retrieving documents from cache in non-preview mode, IsDraft is always false, as only published documents are returned. When retrieving in preview mode, IsDraft can either be true (document is not published, or has been edited, and what is returned is the edited version) or false (document is published, and has not been edited, and what is returned is the published version).
IsPublished(String)
Gets a value indicating whether the content is published.
Declaration
bool IsPublished(string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
A content is published when it has a published version.
When retrieving documents from cache in non-preview mode, IsPublished is always true, as only published documents are returned. When retrieving in draft mode, IsPublished can either be true (document has a published version) or false (document has no published version).
It is therefore possible for both IsDraft and IsPublished to be true at the same time, meaning that the content is the draft version, and a published version exists.