How do I add different inputs to the Optimizely CMS Editor?

  • Page Owner: Not Set
  • Last Reviewed: 2022-03-21

How do I add different inputs to the Optimizely CMS Editor?

Comments

  • Might be worth keyword stuffing this one. Maybe squeeze in a "widget" or "property type" or something? I wasn't sure what the question was asking until reading the answer.

Answer

For CMS 11 and 12:

Create an editor descriptor in code

using EPiServer.Shell.ObjectEditing;
using EPiServer.Shell.ObjectEditing.EditorDescriptors;
using System;
using System.Collections.Generic;

namespace GateCityBank.Web.Business.EditorDescriptors
{
    [EditorDescriptorRegistration(TargetType = typeof(DateTime), UIHint = "TimeOnly")]
    public class TimeOnly : EditorDescriptor
    {
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            base.ModifyMetadata(metadata, attributes);
            ClientEditingClass = "dijit/form/TimeTextBox";
        }
    }
}

A whole list of options can be found on the left pane here