If the ContactBlock is a standard block (i.e. not Local) would it not be better for you to use a ContentArea.
[AllowedTypes(new[] { typeof(ContactBlock) })]
public virtual ContentArea Contacts {get;set;}
If you still wanting to use an IList you will need to create an EditorDescriptor and decorate your property
As an alternative to Minesh's suggestion and what the documentation say I sometimes use IList<ContentReference> limiting it using AllowedTypes
[Display(
Name = "Kontakt",
GroupName = SystemTabNames.Content,
Order = 120)]
[AllowedTypes(AllowedTypes = new[] { typeof(ContactBlock) })]
public virtual IList<ContentReference> Contacts { get; set; }
This will render a control looking like this in CMS 12, the items in the list is draggable and droppable
Here is One Example
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<ContactBlock>))]
public virtual IList<ContactBlock> Contacts { get; set; }
}
[PropertyDefinitionTypePlugIn]
public class ContactOptionPropertyList : PropertyListBase<ContactBlock>
{
}
public class PropertyListBase<T> : PropertyList<T>
{
private readonly IObjectSerializer _objectSerializer;
private Injected<IObjectSerializerFactory> _objectSerializerFactory;
public PropertyListBase()
{
_objectSerializer = _objectSerializerFactory.Service.GetSerializer("application/json");
}
public PropertyListBase(IObjectSerializer serializer)
{
_objectSerializer = serializer;
}
protected override T ParseItem(string value)
{
return _objectSerializer.Deserialize<T>(value);
}
}
Although the editor experience will look like
The UI support for IList<BlockData>
was included in the CMS UI version that was unlisted and then removed IIRC. This should be available again in 12.18. The documentation was never updated when the version was delisted. Sorry for any inconvenience.
Hi,
I am reading the official documentation here: "://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/property-value-list" on how to create list properties. What I would like to do is to create a property that is a list of a custom block type (such as Contact in the docs).
Obviously, I have a block type called ContactBlock.
But the result in the CMS edit mode is always a plain textarea and not the fancy list view shown in the docs. What am I doing wrong? My CMS version is 12.6.1