SaaS CMS has officially launched! Learn more now.

Only allow one block type to be created i content area


Can I limit the creation of blocks to just one type of block when I create a new block locally from the content area? (not drag and drop)

Apr 23, 2014 13:43

Unfortunately, there is a bug which allows the editors to create any block from the "quick link" in the content area. But the attribute AllowedTypes stops editors from using drag-n-drop, this works for ContentReference and PageReference as well.

Edited, Apr 23, 2014 17:54

Hi Sara, you can allow only one kind of block with:

            Name = "Header",
            Description = "Place here the Header Text Block",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        [AllowedBlockTypes(new[] { typeof(HeaderOfferTypeBlock) })]
        public virtual ContentArea HeaderTextBlock { get; set; }

Dec 16, 2014 23:45

Alfredeo, that will unfortunately not stop editors from creating blocks from the "quick link". Your code will only stop editors from drag-n-dropping blocks to the content area.

However, EPiServer is working on a solution where the "quick link" will work as well.

Dec 16, 2014 23:50

Before the arrival of the AvailableTypesAttribute I had an ValidationAttribute class with the same name. I've since changed it name but still use it to restrict the types allowed in content areas.



Dec 18, 2014 9:25
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.