Been trying to make the "Expire date" property (stoppublish) required for a specific page type (or all of them for that matter)
Found this nice blog post from Kalle and ended up with code looking like this:
public class SiteMetadataExtender : IMetadataExtender
public void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)
foreach (ExtendedMetadata property in metadata.Properties)
if ((property.PropertyName == "TeaserText" || property.PropertyName == "iversionable_stoppublish") && property.Parent.Model is CalendarPage)
property.IsRequired = true;
This works for the "TeaserText" property that I have defined myself on the CalendarPage but the built-in "iversionable_stoppublish" gets ignored.
So is there some magic that I'm missing when working with the built-in properties?
My guess is it doesn't work for built-in properties. The workaround is to implement IValidate interface for the specific page type and to do your share of checking. Not sure if this is good enough for you.
Seems you are right.
The IValidate workaround worked. Thanks!
Would be nice to be able to get the property to show up on the required page when creating a new one. Will add a bug for this.