Try our conversational search powered by Generative AI!

Property as ContentArea inside PropertyList Item

Vote:
 

Hello all,

I have a Block:

public class ExpandableBlock : BlockData
{
    [Required]
    [Display(Name = "Heading", GroupName = SystemTabNames.Content)]
    public virtual string Heading { get; set; }

    [Required]
    [UIHint(UIHint.Textarea)]
    [Display(Name = "Sub-Text", GroupName = SystemTabNames.Content)]
    public virtual string SubText { get; set; }

    [Required]
    [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<ExpandableBlockItem>))]
    public virtual IList<ExpandableBlockItem> Items { get; set; }
}

And ExpandableBlockItem Class:

public class ExpandableBlockItem
{
    [Required]
    [Display(Name = "Button Text")]
    public virtual string ButtonText { get; set; }

    [Required]
    [UIHint(UIHint.Block)]
    [Display(Name = "Expandable Area")]
    public virtual ContentArea ExpandableContent { get; set; }

    [Ignore]
    [ScaffoldColumn(false)]
    public virtual string Id => Guid.NewGuid().ToString();
}

Under every ExpandableBlockItem I want to have a ContentArea, so I could put some Block inside.

However it doesn't work and does not allow me to create new block under ExpandableContent property (this is how it renderds - https://i.imgur.com/2uPJCYvl.png). It renders as an area where I can drop some blocks with a text - You can drop content here. - but without a link to Create New Block or Media folder so I could drag some block there.

Thank you in advance, cheers!

#221065
Apr 12, 2020 11:00
Vote:
 

Hi,

PropertyList fully support simple properties(string, int, etc..). To allow the complex property you have to write custom code.

More info-

https://world.episerver.com/documentation/developer-guides/CMS/Content/Properties/generic-propertylist/

PropertyList<T> together with complex types requires additional custom functionality to fully ensure data consistency, portability and functionality

#221089
Apr 13, 2020 8:35
fuji - Apr 13, 2020 8:44
I see, thank you. Will go with some kind of quick workaround for now.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.