Try our conversational search powered by Generative AI!

Globally restrict block in all content areas


We are creating a new non-visual block (i.e. no view) which will solely be referenced in other blocks as a property and would like to globally remove it from the list of available blocks when creating a new block in content areas. I know the AllowedTypes attribute can be used for this on a content area by content area basis, but I am hoping to find a way to apply it to all content areas without manually decorating each individual one in our entire codebase.

Feb 13, 2020 4:20

You can take a look at the ContentTypeAvailabilityService. Should be fairly easy to inherit DefaultContentTypeAvailabilityService and filter that block type.

Feb 13, 2020 7:26

Here is an answer

Example of use:

[ContentType(AvailableInEditMode = false)]
public class B : BlockData
    public virtual string Title { get; set; }
    public virtual XhtmlString Text { get; set; }
Feb 13, 2020 7:34

Of course, how could I forget about that? :)

Feb 13, 2020 8:37
Praful Jangid - Feb 13, 2020 8:41
I reminded you too then :)
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.