Class PublishableContentBase
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
public abstract class PublishableContentBase : ContentBase, IPublishableContentBase, IContentBase, IUmbracoEntity, ITreeEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty
Constructors
View SourcePublishableContentBase(string, int, IContentTypeComposition?, IPropertyCollection, string?)
Declaration
protected PublishableContentBase(string name, int parentId, IContentTypeComposition? contentType, IPropertyCollection properties, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| int | parentId | |
| IContentTypeComposition | contentType | |
| IPropertyCollection | properties | |
| string | culture |
PublishableContentBase(string, IContentBase?, IContentTypeComposition, IPropertyCollection, string?)
Declaration
protected PublishableContentBase(string name, IContentBase? parent, IContentTypeComposition contentType, IPropertyCollection properties, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| IContentBase | parent | |
| IContentTypeComposition | contentType | |
| IPropertyCollection | properties | |
| string | culture |
Properties
View SourceEdited
Gets a value indicating whether the content has been edited.
Declaration
[IgnoreDataMember]
public bool Edited { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Will return true once unpublished edits have been made after the version with
PublishedVersionId has been published.
EditedCultures
Gets the edited cultures.
Declaration
[IgnoreDataMember]
public IEnumerable<string>? EditedCultures { get; set; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> |
PublishCultureInfos
Gets the published culture infos of the content.
Declaration
[IgnoreDataMember]
public ContentCultureInfosCollection? PublishCultureInfos { get; set; }
Property Value
| Type | Description |
|---|---|
| ContentCultureInfosCollection |
Remarks
Because a dictionary key cannot be null this cannot get the invariant
name, which must be get via the PublishName property.
PublishDate
Gets the date and time the content was published.
Declaration
[IgnoreDataMember]
public DateTime? PublishDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
PublishName
Gets the name of the published version of the content.
Declaration
[IgnoreDataMember]
public string? PublishName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
When editing the content, the name can change, but this will not until the content is published.
Published
Gets or sets a value indicating whether this content item is published or not.
Declaration
[DataMember]
public bool Published { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
the setter is should only be invoked from
- the ContentFactory when creating a content entity from a dto
- the ContentRepository when updating a content entity
PublishedCultures
Gets the published cultures.
Declaration
[IgnoreDataMember]
public IEnumerable<string> PublishedCultures { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> |
PublishedState
Gets the published state of the content item.
Declaration
[DataMember]
public PublishedState PublishedState { get; set; }
Property Value
| Type | Description |
|---|---|
| PublishedState |
Remarks
The state should be Published or Unpublished, depending on whether Published is true or false, but can also temporarily be Publishing or Unpublishing when the content item is about to be saved.
PublishedVersionId
Gets the version identifier for the currently published version of the content.
Declaration
[IgnoreDataMember]
public int PublishedVersionId { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
PublisherId
Gets the identifier of the user who published the content.
Declaration
[IgnoreDataMember]
public int? PublisherId { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Methods
View SourceGetPublishDate(string)
Gets the date a culture was published.
Declaration
public DateTime? GetPublishDate(string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture |
Returns
| Type | Description |
|---|---|
| DateTime? |
GetPublishName(string?)
Gets the name of the published version of the content for a given culture.
Declaration
public string? GetPublishName(string? culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture |
Returns
| Type | Description |
|---|---|
| string |
Remarks
When editing the content, the name can change, but this will not until the content is published.
When culture is null, gets the invariant
language, which is the value of the PublishName property.
IsCultureEdited(string)
Gets a value indicated whether a given culture is edited.
Declaration
public bool IsCultureEdited(string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A culture is edited when it is available, and not published or published but with changes.
A culture can be edited even though the document might now have been saved yet (and can have no identity).
Does not support the '*' wildcard (returns false).
IsCulturePublished(string)
Gets a value indicating whether a culture is published.
Declaration
public bool IsCulturePublished(string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A culture becomes published whenever values for this culture are published, and the content published name for this culture is non-null. It becomes non-published whenever values for this culture are unpublished.
A culture becomes published as soon as PublishCulture has been invoked, even though the document might not have been saved yet (and can have no identity).
Does not support the '*' wildcard (returns false).
IsPropertyDirty(string)
Determines whether a specific property is dirty.
Declaration
public override bool IsPropertyDirty(string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
Overridden to include user properties.
PerformDeepClone(object)
Used by inheritors to modify the DeepCloning logic
Declaration
protected override void PerformDeepClone(object clone)
Parameters
| Type | Name | Description |
|---|---|---|
| object | clone |
Remarks
Overridden to deal with specific object instances
ResetDirtyProperties(bool)
Resets dirty properties.
Declaration
public override void ResetDirtyProperties(bool rememberDirty)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | rememberDirty | A value indicating whether to remember dirty properties. |
Remarks
When rememberDirty is true, dirty properties are saved so they can be checked with
WasDirty.
ResetWereDirtyProperties()
Resets properties that were dirty.
Declaration
public override void ResetWereDirtyProperties()
WasPropertyDirty(string)
Determines whether a specific property was dirty.
Declaration
public override bool WasPropertyDirty(string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A property was dirty if it had been changed and the changes were committed.