November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Tanvi,
Can you please explain it more?
Like -do you want to add a specific block in the ContentArea?
ok, then I think AllowedTypes is the best way to do this-
[AllowedTypes(new []{ typeof(YourPageType) })]
public virtual ContentArea Gallery { get; set; }
You have several options.
1. Add an AllowedTypes attribute to your property
[AllowedTypes(typeof(PageData))]
2. Use LinkItemCollection instead of ContentArea
public virtual LinkItemCollection MyLinkProperty{ get; set; }
3. Use List of ContentReference
[AllowedTypes(typeof(PageData))]
public virtual IList<ContentReference> MyContentListProperty{ get; set; }
I'm using ContentArea as I want only specific page links. I dont want to add links for all types of pages.
Can u suggest any code which can restrict the pagetype links to only specific ones in LinkItemCollection?
If you are going to use LinkItemCollection, have a look at this:
https://world.episerver.com/blogs/Per-Nergard/Dates/2019/3/allowedtypes-for-linkitem-collection/
Hi Tanvi,
Please use `Restriction based on base classes and interfaces` to restrict the page and block type contents:
I tried [] but this is allowing the entire pagetype.
I want it to be in form of links. [ ] is not working.
Is there any other way to add ContentReference in the ContentArea
Tanvi, please pass the page types that you want to include in allowed types. Like below ex-
[AllowedTypes(new []{ typeof(YourPageType A), typeof(YourPageType B),
typeof(YourPageType C)})]
public virtual ContentArea Gallery { get; set; }
I'm not what rules you need, but using IValidate lets you be very specific, if restricting by page type is not enough. You could only allow links to pages with a name starting with the letter «C» or pages that are created Friday after 5PM. Or anything else you may think of.
How to Restrict Content Area only to add Links?