November Happy Hour will be moved to Thursday December 5th.

Make block available in edit mode just for a specific block type

Vote:
 

I have made a carousel slider block in which I use slider item blocks. Right now, the slider item blocks are available from everywhere but I want to restrict it so that it is only available in the carousel slider block. How can this be done?

#150700
Jun 28, 2016 9:47
Vote:
 

You can have a look at AllowedTypes attribute that might solve your problem. 

#150702
Jun 28, 2016 9:59
Vote:
 

@Khurram Yeah, I am using that already but the slider item block still shows up for every content area without allowed types set. So I want to specify for the slider item block that it can only be added to the carousel slider block if that is possible.

#150708
Jun 28, 2016 11:25
Vote:
 

The easiest way is probably to use RestrictedTypes on the content areas I'm afraid. Don't think you can specify that on the block...

[AllowedTypes(AllowedTypes = new [] { typeof(BlockData) }, RestrictedTypes = new [] { typeof(EditorialBlock) })]
public virtual ContentArea RelatedContentArea { get; set; }
#150718
Jun 28, 2016 14:12
Vote:
 

RestrictedTypes is part of AllowedTypes attribute, that is what I meant when I said look into AllowedTypes attribute. It works with ContentArea and you can place any kind of content type including Blocktypes in Restricted types.

#150722
Jun 28, 2016 14:39
Vote:
 

Hi Marcus, can you share the detailed process for creating the carousel slider block. I tried creating it by following this link https://world.episerver.com/blogs/egandalf/dates/2015/4/building-a-carousel-using-global-razor-templates-in-episerver-mvc/ , but i din't understand the procedure given. 

#180645
Jul 19, 2017 11:31
* 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.