Class ElementPublishedNotification
A notification that is used to trigger the IElementService when the Publish method is called in the API and after data has been published. Called after an element has been published.
Inheritance
Namespace: Umbraco.Cms.Core.Notifications
Assembly: Umbraco.Core.dll
Syntax
public sealed class ElementPublishedNotification : EnumerableObjectNotification<IElement>, IStatefulNotification, INotification
Constructors
View SourceElementPublishedNotification(IEnumerable<IElement>, EventMessages)
Declaration
public ElementPublishedNotification(IEnumerable<IElement> target, EventMessages messages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IElement> | target | |
| EventMessages | messages |
ElementPublishedNotification(IElement, EventMessages)
Declaration
public ElementPublishedNotification(IElement target, EventMessages messages)
Parameters
| Type | Name | Description |
|---|---|---|
| IElement | target | |
| EventMessages | messages |
ElementPublishedNotification(IElement, EventMessages, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>?, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>?)
Initializes a new instance of the ElementPublishedNotification class with a single element and the cultures that were published and unpublished.
Declaration
public ElementPublishedNotification(IElement target, EventMessages messages, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? publishedCultures, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? unpublishedCultures)
Parameters
| Type | Name | Description |
|---|---|---|
| IElement | target | The element that was published. |
| EventMessages | messages | The event messages collection. |
| IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> | publishedCultures | The cultures that were published, keyed by element Key. |
| IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> | unpublishedCultures | The cultures that were unpublished as part of the publish operation, keyed by element Key. |
Properties
View SourcePublishedCultures
Gets the cultures that were published for each element, keyed by element Key.
Declaration
public IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? PublishedCultures { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> |
Remarks
This reports every culture explicitly published in the operation (not only those whose data changed) — contrast
with SavedCultures, which is a changed-only delta. Populated at
raise-time (change tracking on the entity is reset once persisted, so it cannot be recovered from
PublishedEntities afterwards). For invariant elements the value is ["*"]. The dictionary
itself is null only when the notification was raised without culture information (for example via a
constructor overload that does not accept it).
PublishedEntities
Gets a enumeration of IElement which are being published.
Declaration
public IEnumerable<IElement> PublishedEntities { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IElement> |
UnpublishedCultures
Gets the cultures that were unpublished as part of this publish operation, keyed by element Key.
Declaration
public IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? UnpublishedCultures { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> |
Remarks
Unpublishing an individual culture of a variant element is performed as a publish operation (the element is
re-published with that culture cleared), so the affected culture is reported here — not on an
ElementUnpublishedNotification, which is only raised when the element as a whole is unpublished.
Populated at raise-time; null when unpublishing a culture was not part of this operation at all (for
invariant elements, or a publish that took nothing down).