Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

How to use ModifyMetadata attributes parameter

Vote:
 

Hi! Can somebody explain to me how exactly to use the second parameter from the ModifyMetadata method?

In the documentation the description states: "The custom attributes attached to the model class."

What is the model class?

I have a propertylike this:

[EditorDescriptor(EditorDescriptorType = typeof(LinkItemLiteEditor))]
public virtual LinkItemCollection Links{ get; set; }

And I would like to add some parameters to be used in the ModifyMetadata method. Is it possible?

The goal is to use different linkItem editors for different LinkItemCollection properties.

#225917
Edited, Jul 30, 2020 10:59
Vote:
 

Hi Ravinda! Thanks for the links. There is nothing in those links that touches anything about the attributes parameter. Do you have any other links that could answer my initial question?

#226131
Aug 05, 2020 9:23
Vote:
 

If you add attributes to your model, they will show up in the attributes parameter.

A simple example. Adding the attribute [CultureSpecific] will make it turn up in the attributes parameter.

[CultureSpecific]
[EditorDescriptor(EditorDescriptorType = typeof(LinkItemLiteEditor))]
public virtual LinkItemCollection Links{ get; set; }

You may create your own custom attributes, to suit your specific needs.

PS. Thanks for mentioning my blog posts Ravindra, even if they did not help :-)

#226143
Aug 05, 2020 10:51
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.