Force form edit view for content in Episerver

This code sample demonstrates how to force form editing for specific content types in Episerver, for scenarios where on-page editing isn't practical.

  • Ted Nyberg
  • 31 August 2016
  • 0

One way of customizing how a content type behaves in Episerver is to use descriptors.

Let's say I have a block or page type called MyContentType. By adding the following class to my project I can make form editing, i.e. the "All Properties" view, the default for whenever content of type MyContentType is edited:

C# Expand
[UIDescriptorRegistration]
public class MyContentTypeDescriptor : UIDescriptor<MyContentType>
{
    public MyContentTypeDescriptor() : base("dijitIcon")
    {
        // Make form editing the default for this content type
        DefaultView = CmsViewNames.AllPropertiesView;
    }
}

Descriptors can be used for a wide variety of customizations, for example to change the icon used to represent the content type in the page tree, media pane, etc:

C# Expand
[UIDescriptorRegistration]
public class MyContentTypeDescriptor : UIDescriptor<MyContentType>
{
    public MyContentTypeDescriptor() : base("dijitIcon")
    {
        // Change icons, based on available icons at http://ux.episerver.com
        IconClass = $"{IconClass} epi-iconProduct".Trim();
    }
}