I’m in the process of updating a website from V11 to V18, so effectively it’s a rebuild of the site as it’s about 5 or 6 years old and due a rewrite anyway. It’s for my football club and obviously one of the document types is a fixture type.
On the V11 site, I was able to generate a default name of ‘TBC’ for this document using INotificationHandler handler and then when the fixture document is saved I would rename it as Home Team + Away Team + Fixture Date.
I would like to do the same in the V18 site and you cannot save a document with no name assigned to it, so the name creation procedure never fires.
I cannot find any handlers relating to content creation to use with a INotificationHandler class. Can anyone point me in the right direction or give me some pointers.
For reference, the old code was as follows, and worked really well…
public class FixtureNotificationHandler : INotificationHandler<SendingContentNotification>
{
public void Handle(SendingContentNotification notification)
{
if (notification.Content.ContentTypeAlias == Fixture.ModelTypeAlias)
{
foreach (var v in notification.Content.Variants)
{
if (v.State == ContentSavedState.NotCreated)
v.Name = "TBC";
}
}
Cheers in advance
Iain