Tags: Egenskaper

Hiding Episerver’s Category property

Do not confuse your editors. If they do not need the property, they do not need to see it! Episerver has a lot of built-in properties, that are not used on all websites.

If they do not need the category property, hide it!

Episerver's category property

The Category property, as seen above, can be hidden using an EditorDescriptor like this:

[EditorDescriptorRegistration(TargetType = typeof(CategoryList))]
public class HideCategoryEditorDescriptor : EditorDescriptor
{
    public override void ModifyMetadata(ExtendedMetadata metadata, 
        IEnumerable<Attribute> attributes)
    {
        base.ModifyMetadata(metadata, attributes);
        if (metadata.PropertyName == "icategorizable_category")
        {
            metadata.ShowForEdit = false;
        }
    }
}
Found this post helpful? Help keep this blog ad-free by buying me a coffee! ☕