https://world.episerver.com/documentation/developer-guides/CMS/Content/Properties/built-in-property-types/Restricting-content-types-in-properties/ is what you want. There's an out the box property no for ContentReferences and PageReferences
Hi Scott,
Thanks for your answer, but this is not what I'm really looking for.
I already known the usage of AllowedTypes, but I want a dropdown with blocks of a specific type to select.
So not dragging the block item to the ContentReference property, but select the block from a dropdown list containing all blocks of that type.
Hopefully it is more clear now?
I don't have the time to test this, but off the top of my head I think at the start of CMS 11 they changes all the JS types from . separation to kebab case (-).
I checked some of our code and it should be epi-cms/contentediting/editors/SelectionEditor as the client editing class
I've just checked our code again.
Try also adding
[EditorDescriptor(EditorDescriptorType = typeof(ContentSelector))]
Above the property, you may need to remove the ContentSelection attribute. If I can get time I'll try and look in to it but I'm busy with a client project atm
Hi,
Is there a way in Episerver 11 to get this working (the global variant):
http://joelabrahamsson.com/limiting-content-and-page-reference-properties-to-values-of-a-specific-type-in-episerver-cms/
After added all steps from the post I tried several things, but nothing seems to work.
I still get the default picker when I use:
[ContentSelection(typeof(MyBlock))]
public virtual ContentReference MyProperty { get; set; }
Also when I changed propertytype from ContentReference to string or changed the ContentSelector ClientEditingClass from "epi.cms.contentediting.editors.SelectionEditor" to "app/Editors/HtmlSelectionEditor".
Anyone else has the same problem or a solution?
Thanks in advance.
Grtz Sander