SaaS CMS has officially launched! Learn more now.

Only allow a block in one specific content area


I have a situation where I have a block that should only appear in a few specific content areas. Meaning I want to prevent it from being used anywhere else. I know you can use the [AllowedTypes(...)] attribute on specific ContentArea properties to allow or restrict types, but short of setting [AllowedTypes(...)] with my particular block type as restricted on every single ContentArea in the entire solution, is there some way for me to indicate that the default behavior for this block is for it to be restricted?

Mar 15, 2018 8:58

Some ideas:

Use allowed types with an interface so you only need to decorate where you want the block to be used:

Implement an IValidator interface that checks the content areas on a page and looks for your block type and warn users appropriately:


Mar 15, 2018 9:47

I may be a little late to this game, but I use eGandalf's plugin for doing this.

You can grab it from the Epi nuget package manager.

Oct 03, 2018 23:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.