Make content area with only one allowed type only create selected type

Vote:
 

I have a contentarea on my site that is supposed to only contain one block type, I have set the [AllowedTypes]-attribute on the property, but when i click the "create a new block"-button on the contentarea overlay I'm still presented with a list of choices, is there any way to make episerver skip the "select block type"-screen and automatically create a block with the type specified in the [AllowedTypes]-attribute? I have a solution for it using some dojo-hacks, but it's not optimal, and in my opinion it should be a feature in EPiServer. Has anyone else had a similar problem? If so, any good solutions out there?

#85443
Apr 25, 2014 11:01
Vote:
 

Unfortunately it is a bug that the attribute only blocks drag & drop as it is today.

#85470
Apr 25, 2014 17:35
Vote:
 

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

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

#114647
Dec 16, 2014 23:49
* 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.