Don't worry! I think this's also a bug. ;)
But we can easy to live with as below:
[PageListBlock.cs]
[Display(
GroupName = SystemTabNames.Content,
Order = 5)]
[Required]
[UIHint("PageReferenceExtended")]
public virtual PageReference Root { get; set; }
Create new editor descriptor: (e.g: PageReferenceEditorDescriptorEx.cs)
[EditorDescriptorRegistration(TargetType = typeof(PageReference), EditorDescriptorBehavior = EditorDescriptorBehavior.ExtendBase, UIHint = "PageReferenceExtended")]
public class PageReferenceEditorDescriptorEx : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
base.ModifyMetadata(metadata, attributes);
AllowedTypes = new Type[] { typeof(ArticlePage) };
EditorConfiguration["dndSourcePropertyName"] = "contentLink";
}
}
That all!
// Ha Bui
This is still a problem in latest version. Tried AllowedTypes on a property of type ContentReference to make sure only one type of page could be used. Same error. Any idea if this will be solved in future releases of episerver?
Did you try lightly change "PageReference" to "ContentReference" ?
The key in my previous posting is:
EditorConfiguration["dndSourcePropertyName"] = "contentLink";
I've been reported this bug and will update bug's link here later.
This actually my mistake, I missed it and don't report it's ealier. So sorry!
//HaBui
Ok, so when the bug is fixed we don't need to use your extra UIHint, only AllowedTypes?
Hi,
I've tried this with standard Alloy installation and there is weird thing. Simply edit the PageListBlock, and put AllowedTypes (typeof(ArticlePage)) to the property "Root" which is PageReference.
When I go to Form Editing, try to drag and drop my Article page to the property, I got an error:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'EPiServer.Core.PageReference' because the type requires a JSON string value to deserialize correctly. To fix this error either change the JSON to a JSON string value or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'isPreferredLanguageAvailable', line 1, position 32.
The page picker is still working as expected with restriction of content type. I know there is a known bug with drag and drop in Edit view. But what about Form editing? Does anyone know why and how to fix it?
Thanks,
/Dung Le