Configuring editors for your properties

Mari Jørgensen
Member since: 2003
 

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
  • Linus Ekström
    Member since: 2002
     

    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
  • Mari Jørgensen
    Member since: 2003
     

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

    #65282 Jan 24, 2013 15:00