AI OnAI Off
Unfortunately I don't think there is a way other than a migration. For these boolean cases (where I can't check for null somewhere in my code and use a default there) I sometimes revert the logic, if I find it semantic enough. But perhaps DontShowInMenu is not the best thing after all...
I would prefer if it could mimic the same semantics as the built in page, but I think I will have to go with a "HideInMenu" property instead.
Just make sure you use the SetDefaultValues to get the desired value for future creations of the content :)
I have a lot of existing categories.
Now I want to add a new "VisibleInMenu" bool property to categories, and I want it to be checked by default i all the exisiting categories.
I have tried the SetDefaultValues approach, which did not work:
public override void SetDefaultValues(ContentType contentType)
{
base.SetDefaultValues(contentType);
VisibleInMenu = true;
}
I've tried overwrititng the get/set of the property, and that did not work:
[Display(Name = "Display in navigation", GroupName = SystemTabNames.PageHeader, Order = 1000)]
public virtual bool VisibleInMenu
{
get
{
return (bool)(this["VisibleInMenu"] ?? true);
}
set
{
this["VisibleInMenu"] = value;
}
}
Is this even possible without looping through all the categories and setting the value?