Hide default category property

Vote:
 

Hi!

Does anyone know how to hide the default category property in Optimizely 12? The editor descriptor with the scaffold attribute works in older versions, but it doesn't seem to work in version 12.

#299983
Apr 12, 2023 13:14
Vote:
 

Have a look at Geta.Optimizely.Categories repo they have an example here on how it can be achieved using an editor descriptor. I tested on a CMS12 site and looks to work 

geta-optimizely-categories/HideCategoryEditorDescriptor.cs at master · Geta/geta-optimizely-categories (github.com) 

   /// <summary>
   /// Hides the categories drop down list for types where it is not needed
   /// </summary>
    [EditorDescriptorRegistration(TargetType = typeof(CategoryList), EditorDescriptorBehavior = EditorDescriptorBehavior.Default)]
    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;
            }
        }
    }
#299984
Edited, Apr 12, 2023 13:29
Vote:
 

Thanks. I tried it in an Alloy solution here, and it works there. So I guess it must be something in our solution that is causing it not to work.

#299990
Apr 12, 2023 15:14
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.