Configuring editors for your properties

Vote:
 

In EPiServer 7, you can configure custom editors for your properties, ref: 
http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/9/EPiServer-7-Configuring-editors-for-your-properties/

But what if the drop down list items depends on property settings data?
I'm basically looking for a way to get the settings object (and still use the new ui), similar to this:

var settings = PropertyData.GetSetting(typeof(TagSelectorSettings)) as TagSelectorSettings;

    

I assume this can be fetched from the EditorDescriptor class or the meta data object, but I haven't found a method to use.

Anyone?

 

#65183
Jan 22, 2013 17:31
Vote:
 

You can try casting the model to a PropertyData object. This is an extract of how we set up the Tiny MCE editor:

public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            base.ModifyMetadata(metadata, attributes);

            //Grab property data
            var propertyData = metadata.Model as PropertyData;

if(propertyData == null)
{return;}//Always check for null after "as" statement

            //Load settings
            TinyMCESettings propertySettings = (TinyMCESettings)propertyData.GetSetting(typeof(TinyMCESettings));

    

#65188
Jan 22, 2013 20:30
Vote:
 

Thanks, Linus! I'll try that. :)

#65282
Jan 24, 2013 15:00
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.