November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
AvailableContentType also has IncludeOn and IncludeOff ExcludeOn.
maybe you can use this in combination with a base page thats common to all your pages?
I believe IncludeOn and IncludeOff are prioritized over Include / Exclude so most likely the right combinations of these will allow you to specify a default behaviour and then only add to a list when you need an exception to the rule.
Not IncludeOff, but ExcludeOn.
I think DD is aware of those attributes, he/she is just wondering if there is a way to make it more future proof. I am not aware of such method, except for using the base class, but it is not completely future proof.
If you don't want to use a base class, you can create an interface with a UI Descriptor and use that in content restrictions. I do something similar with blocks in builds:
public interface IContentBlock : IContentData
{
}
[UIDescriptorRegistration]
public class ContentBlockUIDescriptor : UIDescriptor<IContentBlock>
{
}
public class HomePage : SitePageData
{
[Display(
Name = "Content",
GroupName = GroupNames.Content,
Order = 10)]
[AllowedTypes(typeof(IContentBlock))]
public virtual ContentArea? Content { get; set; }
}
You could adapt this solution for pages by setting up the following:
public interface IBlogPage : IContentData
{
}
[UIDescriptorRegistration]
public class BlogPageUIDescriptor : UIDescriptor<IContentPage>
{
}
[ContentType(
DisplayName = "Blog Container Page",
GUID = "C64CDD71-5AB6-44E6-84B6-92266F4B8FA6",
GroupName = GroupNames.Content)]
[AvailableContentTypes(Availability.Specific, Include = new []{typeof(IBlogPage )})]
public class BlogContainerPage : SitePageData
{
}
[ContentType(
DisplayName = "Blog Page",
GUID = "F052D9C2-1343-48C1-A0FC-13D4748032E0",
GroupName = GroupNames.Content)]
public class BlogPage : SitePageData, IBlogPage
{
}
Hello Marc,
Thanks for the inputs. The solution above is for a parent page to restrict what child pages it can have. I am looking for something, where a page (child page) in this context can restrict under which parent it can be created. Let me know if am missing something.
Hello DD,
I did some experimentation to try and solve your problem. I noted that If a type implemented both an interface or inherited a base class that met the criteria of both IncludeOn and ExcludeOff on a child type, then the child could not be placed under the parent despite it matching the IncludeOn types and if the parent page type matched both criteria then it could not have any pages created under it. And when you restrict to just using IncludeOn without an ExcludeOn then it really becomes a bit pointless.
Personally I would just stick to restricting from the top downwards (e.g. have the parents restrict what is allowed beneath them). From my own experience, these kind of page restrictions are often one of the first things that gets removed once a project goes into BAU as it inhibits the Information Architecture of the site.
Hello guys,
I have a need to create a content page (say BlogPage) and it needs to be available to create only under BlogContainer Type page. While I can use the AvailableContentType option on various pages where to include or exclude, I am thinking more from a long term that if new page types are added, I don't have to update the list on them. Any ideas in achieving this would be helpful.