Mike Masey
08/08/2023, 11:31 AMRavi
08/08/2023, 11:38 AMJason
08/08/2023, 2:36 PMSendingContentNotification
to adjust the property's validation settings as it gets loaded.Jason
08/08/2023, 2:42 PMcsharp
public class EditorSendingContentNotificationHandler : INotificationHandler<SendingContentNotification>
{
public void Handle(SendingContentNotification notification)
{
// something to determine if this is content you want to modify...
if (notification.Content.ContentTypeAlias.Equals("blogpost"))
{
foreach (var variant in notification.Content.Variants)
{
var shouldBeManadatory = variant.Tabs.SelectMany(f => f.Properties)
.FirstOrDefault(f => f.Alias.InvariantEquals("propertyAlias"));
if (shouldBeManadatory is not null)
{
shouldBeManadatory.Validation.Mandatory = true;
}
}
}
}
}
Mike Masey
08/08/2023, 3:08 PMMike Masey
08/08/2023, 3:51 PMRavi
08/09/2023, 6:48 AMAmbert
08/09/2023, 8:03 AM