public void AllowChildTypes(IEnumerable<ContentType> contentTypes, bool setOnAncestorIfInherits = false, bool throwOnError = true, bool save = false)
{
if (contentTypes == null)
throw new ArgumentNullException("contentTypeNames");
switch (this.NodeType.Name)
{
case "Folder":
case "Page":
if (setOnAncestorIfInherits)
{
var parent = this.Parent as GenericContent;
if (parent != null)
{
parent.AllowChildTypes(contentTypes, setOnAncestorIfInherits, throwOnError, true);
}
else
{
if (throwOnError)
throw GetCannotAllowContentTypeException();
}
}
else
{
if (throwOnError)
throw GetCannotAllowContentTypeException();
}
return;
case "SystemFolder":
if (throwOnError)
throw GetCannotAllowContentTypeException();
return;
default:
SetAllowedChildTypes(contentTypes, throwOnError, save);
return;
}
}
private void SetAllowedChildTypes(IEnumerable<ContentType> contentTypes, bool throwOnError = true, bool save = false)