Quantcast
Channel: Forum
Viewing all articles
Browse latest Browse all 3613

Restrict Blocks in ContentArea

$
0
0

I'm having a issue restricting what kind of Block to be inserted in a ContentArea. What I want is that the SliderBlock's ContentArea property can only have insertion of a SlideItemBlock.

My block classes:

[ContentType(...)]
public class SlideItemBlock : BlockData
{
	[Required]
	Display(Name = "Image")]
	public virtual string Image { get; set;}
}
[ContentType(...)]
public class SliderBlock : BlockData
{
	[Required]
	[Display(Name = "Slides")]
	public virtual ContentArea Slides { get; set; }
	//Should only accept insertion of SlideItemBlock
}

    

Or is this the wrong way to achive what I'm trying to restrict for the editor to not drag and drop wrong block types?

As of now, I can create a SliderBlock and insert a SlideItemBlocks in it. If I then insert the created SliderBlock in a new SliderBlock I get a forever and ever loop and It breaks the site. This is what I'm trying to control.


Viewing all articles
Browse latest Browse all 3613

Latest Images

Trending Articles



Latest Images