November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
AllowedTypes will stop the editor from drag n' drop content and also from the All Properties view. However, it will not stop editors from using the quick link in the property to create a new block, which is bad.
AllowedTypes doesn't work with interfaces or base classes. But you can override this behaviour. Given you have an interface called ITag and you want to limit the content area to just content that implements this interface:
[UIDescriptorRegistration]
public class TagUIDescriptor : UIDescriptor
{
}
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class InitializationModule1 : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
var uiDescriptorRegistry = ServiceLocator.Current.GetInstance();
var descriptors = uiDescriptorRegistry.GetAllRegisteredUIDescriptors();
var types = new[]
{
typeof(ITag)
};
foreach (var descriptor in descriptors)
{
foreach (var type in types)
{
if (type.IsAssignableFrom(descriptor.ForType))
{
descriptor.DndTypes.Add(type.FullName.ToLowerInvariant());
}
}
}
}
public void Preload(string[] parameters) { }
public void Uninitialize(InitializationEngine context) { }
}
Oh btw, this topic is discussed here http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=86968
Hi Johan,
I'm not using interfaces / base classes in AllowedTypes attribute.
edit:
The editor cannot 'drag & drop' disallowed block types, but he can still click on 'create a new block' link and get a list of all block types. Can I filter that list somehow? I know that I can create a custom Validator and prevent the editor to save the page, but I'd like to filter that list as well.
Thanks!
"However, it will not stop editors from using the quick link in the property to create a new block, which is bad."
Great that it is reported as a bug now.
It's been reported as a bug for quite some time, and it also has by far, the most votes on the bug list so I really hope that it means that the development team get's this fixed soon. FYI: There is actually need for some new functionality to solve this "glitch" and that's the main reason why it has not been fixed yet.
Hey, Linus, do you have any info about when this bugfix will be released?
Hi,
We are planing to start to work on this feature very soon. Right now we are working hard to get the IE 11 support out (TinyMCE upgrading right now) and it has taken longer than expected.
But I can't give you an exact date when it is going to be released. But it has very high priority.
/Magnus
Hi,
I'm using EPiServer 7.13.1. I want to restrict the content types in ContentArea. I tried with both AllowedTypes attribute and custom EditorDescriptor but nothing works. The editor is still allowed to create all block types inside that ContentArea.
http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2013/12/Restriction-of-content-types-in-properties/
http://world.episerver.com/Blogs/Ben-McKernan/Dates/2013/11/Restricting-the-allowed-types-in-a-content-area/
Any help would be greatly appreciated!