Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Restict Content Area to Only Allow Global Blocks

Vote:
 

Hi guys,

Wondering if anyone has come across a method of restricting a content area to only allowing global/shared blocks in the content area. 

Any help would be appreciated.

Thanks

#195259
Jul 18, 2018 18:34
Vote:
 

Hi David

Have you considered using an IValidator<T>? 

David

#195264
Jul 18, 2018 21:27
Vote:
 

I was going to answer the same about IValidator of T, but would be great to have more human friendly UI -> that dropping is enabled only for allowed blocks. this might involve spelling some dojo magika..

#195269
Jul 19, 2018 5:55
Vote:
 

Hi guys,

Yes sorry I should've expanded on my question really.. was more wondering whether there were a way to remove the "Create a new block" option within the content area - and hence restricting it down to only allow shared blocks essentially. 

Thanks

#195280
Jul 19, 2018 10:30
Vote:
 

Hi David.

Other Episerver friends of ours has done something you'll find useful.

Try and have a look here:

https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2014/9/Disable-create-new-block-for-content-area/

Please note; it does not mean editor simply can't create a new block through the Asset pane, under "For This Page". 

/Casper Aagaard Rasmussen

#195282
Edited, Jul 19, 2018 10:55
Vote:
 

Yes you could do something like this

[AllowedTypes(new []{ typeof(XBlock), typeof(YBlock)})]
public virtual ContentArea MainContentArea { get; set; }

or

solution is to add an interface to the block:

public class SliderBlock : INotAvailableContent {}

The interface and descriptor:

public interface INotAvailableContent { }

[UIDescriptorRegistration]
public class NotAvailableContentDescriptor : UIDescriptor<INotAvailableContent> { }

The ContentArea defintion:

[AllowedTypes(RestrictedTypes = new[] { typeof(INotAvailableContent) })]
public virtual ContentArea MainContentArea { get; set; }

Now you can easy add INotAvailableContent for ContentAreas and blocks to avoid them.

#195778
Edited, Aug 07, 2018 14:58
Vote:
 

Hey David

This may be exactly what you are looking for:

https://gregwiechec.com/2016/05/how-to-disable-creating-new-blocks-in-content-area/

David

#195856
Aug 09, 2018 14:00
* 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.