Creating a spesific blocktype within a contentarea

Vote:
 

I want to have a contentarea which contains blocks of a spesific type. The blocks can only be created within the contentarea, they are not visible for the editors (AvailableInEditMode=false)

A ordinary contentarea has the functunality of 'You can drop content here, or Create a new block', but when i add the [AllowedTypes(typeof(SpesificBlock))] attribute to the contentarea 'Create a new block' dissapears.

What to do?

Is it a bug?

#158306
Sep 27, 2016 10:59
Vote:
 

If you make sure that the specific block is "Available in edit mode", does the "Create a new block" appear then?

#158320
Sep 27, 2016 13:25
Vote:
 

Yes, the "Create a new block" option appear while the spesific block is 'availeble in edit mode'. But then the block is available for the editors to create it 'all over the place'

Is there another way to create a block within a content area and no where else?

#158330
Sep 27, 2016 15:26
Vote:
 

CMS 11.14

I know this is an old post but I, too, have the same problem.

I have a main block that will be free to create for editors and the block has a ContentArea inside where there's only one block type is allowed, say block B. When I decorate block B as AvailableInEditMode=false, I cannot create the block B inside the ContentArea; the link 'create a new block' dissapears. See the following code for an example that's not working as intended.

    public class A : BlockData
    {

        [AllowedTypes(typeof(B))]
        [CultureSpecific]
        public virtual ContentArea Items { get; set; }

    }
    [ContentType(AvailableInEditMode = false)]
    public class B : BlockData
    {
        public virtual string Title { get; set; }
        public virtual XhtmlString Text { get; set; }
    }

I am trying to use blocks instead of Generic PropertyList because property lists are not recommended anymore, am I doing something wrong?

#211055
Edited, Dec 16, 2019 16:50
Vote:
 

AvailableInEditMode is applied both when creating a block in the asset panel (among the folders) and when clicking create a new block.

I guess you can get a workaround making your own content type advisor https://talk.alfnilsson.se/2016/04/17/customize-suggested-pageblock-types-when-creating-content/

And see if you can identify that you're creating a block in a content asset folder

#211059
Dec 16, 2019 20:25
* 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.