Force form edit view for content in Episerver

Force form edit view for content in Episerver

1 minutes

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

Migrated article

This article was migrated from an older iteration of our website, and it could deviate in design and functionality.

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:

[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:

[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();
    }
}
Last updated: 2017-04-18