Mikkel Johansen
10/02/2024, 2:32 PMbuilder.AddNotificationHandler<ContentSavingNotification, SavingNotification>()
And implemented it with
public class SavingNotification() : INotificationHandler<ContentSavingNotification>
{
public void Handle(ContentSavingNotification notification)
{
// .. do stuf changing value of property
}
}
All is good - the value of the property is changed before save and is saved correct.
BUT the user can not see the value has changed!!
AND if the user clicks "save" again, the old values is send to the server.
The user has to switch to another content node and back again or reload the page.
Is it some way possible to set a value in the ContentSavingNotification that sends a message back to the backoffice that updates the properties or force a reload of the page.Mikkel Johansen
10/03/2024, 6:20 AMLewis Heaton
10/03/2024, 8:46 AMpublic class SomeSavingHandler : INotificationHandler<ContentSavingNotification>
{
public void Handle(ContentSavingNotification notification)
{
foreach (var item in notification.SavedEntities)
{
item.SetValue("someAlias", "some value");
}
}
}
Where my code seems to differ, I have another notification hander on the ContentPublishingNotification
public class SomePublishingHandler : INotificationHandler<ContentPublishingNotification>
{
public void Handle(ContentPublishingNotification notification)
{
foreach (var entity in notification.PublishedEntities)
{
entity.SetValue("anotherAlias", "anotherValue");
}
}
}
We need the two seperate handlers for reasons specific to the project, unsure if it makes any difference, perhaps change your SavingNotification to a ContentPublishingNotification?Mikkel Johansen
10/03/2024, 11:16 AMLewis Heaton
10/03/2024, 11:17 AMMikkel Johansen
10/03/2024, 1:58 PM