How to have an ISelectionFactory that render as a list of icons



I have a list box in me block in edit mode that allow me to select an icon: 

The Descriptor is like this:

    [EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "PageIcon")]
    public class PageIconEditorDescriptor : EditorDescriptor
         public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)
             SelectionFactoryType = typeof(PageIcons);
             ClientEditingClass = "epi.cms.contentediting.editors.SelectionEditor";
             base.ModifyMetadata(metadata, attributes);


The selection factory used is like this:

    public class PageIcons : ISelectionFactory
        public static List types = new List
            new SelectItem {Value = "icon-left-big", Text = ""},       
            new SelectItem {Value = "icon-up-big", Text = ""},            

and It is defined like this:

        [Display(GroupName = SystemTabNames.Content, Order = 3)]
        public virtual string PageIcon { get; set; }

It used to work fine but not it is just showing the unencoded Text field. It lloks like whe I updated from episerver 7 to 7.5 the selection started to encode the Text field while it was not doing it before.

Any Idea on how to obtain a SelectItem the will render the html as I write it instead of as text?

Dec 11, 2014 16:04

I ran into the same problem when upgrading to 7.18.

Solution for me was to get SelectionEditor.js from 7.15, which does not encode the html. (Create a dummy new EPiServer-project in Visual Studio and install the uncompressed dojoscripts by installing nuget-package EPiServer.CMS.UI.Sources. You need to specify a specific version, otherwise you automatically get the latest. Version history at nuget.)

1. Save the js-file as e.g. SelectionEditorHTML.js in /ClientResources/Scripts/Editors.

2. Add this to module.config.

<add name="mysite" path="Scripts"/>

3. In the method ModifyMetadata, change ClientEditingClass to

ClientEditingClass = "mysite.editors.SelectionEditorHTML";
Jan 09, 2015 13:21
* 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.