Decorate propertis with property settings?



Is it possible to decorate propertis with property settings?

I have property settings for a custom property and would like to specify those settings on my properties, it's quite cumbersome to go into admin mode and set those settings.

May 31, 2013 11:06

Last time I checked there wasn't a built in configuration builder similar to what you could find in PageTypeBuilder.

If you have an existing PropertySetting or creating one at startup I guess you can use an EditorDescriptor to set your configuration.

Checkout EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors.XhtmlStringEditorDescriptor in the EPiServer.Cms.Shell.UI (usually found in the Modules-path among your VPP) for some inspiration.

    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
      base.ModifyMetadata(metadata, attributes);
      TinyMCESettings settings = (TinyMCESettings) ((PropertyData) metadata.Model).GetSetting(typeof (TinyMCESettings));
      ExtendedMetadata mostContentMetadata = ExtendedMetadataExtensions.FindTopMostContentMetadata(metadata);
      IContent content = mostContentMetadata != null ? mostContentMetadata.Model as IContent : (IContent) null;
      TinyMCEInitOptions tinyMceInitOptions = new TinyMCEInitOptions(TinyMCEInitOptions.InitType.EditMode, settings, content);
      if (metadata.IsReadOnly)
        tinyMceInitOptions.InitOptions["readonly"] = (object) true;
        tinyMceInitOptions.InitOptions["body_class"] = (object) "mceReadOnly";
      metadata.EditorConfiguration.Add("width", tinyMceInitOptions.InitOptions["width"]);
      metadata.EditorConfiguration.Add("height", tinyMceInitOptions.InitOptions["height"]);
      metadata.EditorConfiguration.Add("settings", (object) tinyMceInitOptions.InitOptions);


Edited, Jun 03, 2013 14:21
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.