What's in your head?

Tomas Hensrud Gulla

In Episerver CMS, you are probably familiar with the fundamental concept of grouping properties into tabs. You may place your own properties in the existing tabs (Content, Settings etc) or create your own tabs with descriptive names.

You may, however also tamper with the special tab PageHeader!

What if editors never use the property «Display in navigation», but very often need to use «Update modified date»? Wouldn't it be more practical if they switched places? We can do that!

We simply add an EditorDescriptor, telling the properties that they do belong to another tab.

[EditorDescriptorRegistration(TargetType = typeof(ContentData))]
public class MoveInAndOutOfHeadEditorDescriptor : EditorDescriptor
{
    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
    {
        foreach (var modelMetadata in metadata.Properties)
        {
            var property = (ExtendedMetadata)modelMetadata;
            if (property.PropertyName == "ichangetrackable_setchangedonpublish")
            {
                property.GroupName = SystemTabNames.PageHeader;
                property.Order = 12;
            }
            if (property.PropertyName == "PageVisibleInMenu")
            {
                property.GroupName = SystemTabNames.Settings;
                property.Order = -76;
            }
        }
    }
}

The final result will look like this: