Sure you can. In your project, create and register a new editor descriptor for CategoryList. Override ModifyMetadata method to check if the owner content is of that page type then set ShowForEdit to false.
Some thing like this:
[EditorDescriptorRegistration(TargetType = typeof(CategoryList))]
public class NewCategoryEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
var ownerContent = ((ContentDataMetadata)metadata).OwnerContent;
if (ownerContent is StandardPage)
{
metadata.ShowForEdit = false;
}
}
}
Duong, ContentDataMetadata resides in EPiServer.Cms.Shell.UI.dll which is located in the modules (packaging) VPP. Out of curiousity, is it recommended to add a reference to that assembly? If so, that means that the modules VPP must be checked in into source control or the project won't build for other devs. Maybe that's not an issue, but I'd be really interested to hear your/EPiServer's view on this.
Joel, there was a nice discussion among us and the addon team. We came up with conclusion that since it depends on an addon (Sparrowhawk), it should also be an addon so the site will be able to update.
That would be my best suggestion for now.
I can imagine :)
Not solving the greater problem of referencing Sparrowhawk assemblies an alternative solution here may be to use a duck.
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
dynamic mayQuack = metadata;
var ownerContent = mayQuack.OwnerContent as IContent;
if (ownerContent is StandardPage)
{
metadata.ShowForEdit = false;
}
}
Very neat solution for the original problem. I assume DLR's performance is not a big issue.
Nice solution. I always wondered why it is enabled by default (I don't like showing unused and thus confusing functionalities), but have always more important stuff to work on. I found this topic by accident, but already implemented in my project. Thanks!
Works well for me. How about if i just wanted to change which tab the category appears on. At the moment it always shows in the content tab, not even in a categories tab. I would like to move it to the settings tab.
Thanks
Is it possible to hide the category property on a specific pagetype in CMS7?