How to hide/remove 'Main Body' and 'Large content area' from editor?

Ed
Ed
Vote:
 

I don't want to use these fields. How do I remove them? This seems like it should be way easier to do than it is. 

#229102
Oct 07, 2020 19:01
Vote:
 

What about removing those from the content type definition (code) ?

#229125
Oct 08, 2020 4:40
Vote:
 

Removing it from code is your first response. Don't want code (or properties) that isn't used. 

Other options are:

  1. Using the ignore attribute
    [Ignore]
    public virtual int ThisPropertyIsHidden { get; set; }​
    This will remove it in edit mode altogether. Note though that it won't be indexed by search either...
  2. Using the Editable attribute
    [Editable(false)]
    public virtual string NotEditableProperty {get;set; }​
    This will show the value to the editor but they can't change it
  3. Using the ScaffoldColumn attribute
    [ScaffoldColumn(false)]
    public virtual string HideThisPropertyFromEditors { get; set; }​
    Very similar to Editable attribute above. 
  4. Move the property to a tab that has higher access rights requirement

I would recommend using the Editable attribute normally if you want to have the property in the background but not allowing the editor to touch it.  

#229135
Edited, Oct 08, 2020 7:57
Vote:
 

[ScaffoldColumn(false)] hides the property from the edit UI, but you can still work with it programmatically.

#229144
Oct 08, 2020 8:55
Ed
Vote:
 

I tried a few of these methods. Removing the property seemed the most obvious, but no luck. I got frustrated and moved on to some other content types and the creation worked as I hoped. The long and short of it is that it seems somehow my original content type is cached somewhere. That type and other types all inherit from the same base class extended from PageData, but it is working as though the code hasn't changed since yesterday afternoon. 

The really strange thing, if I change the file and class name from TechnologyInstructionPage to TechnologyInstruction it works as exactly I hope it would. But then when I change back to TechnologyInstructionPage it has old properties showing up I've since deleted from the code and were in a parent class it is no longer inheriting from. It as though something is cached somewhere. This is a strange behavior that only changing the page name actually fixes it. I'd like to have all my content types with the "Page" string as end of file name for consistency, but if I do I end up with some old version of code executing. This is ... worrisome. I have no idea what is causing this.

#229183
Oct 08, 2020 17:59
Vote:
 

A few things to note. Properties that have values are not removed. You can however "force remove" them from admin mode. Renaming a content type, without having specified an ID (which is hightly recommended by the way), will create a new type. So that's probably what you're seeing. 

#229184
Oct 08, 2020 18:04
Vote:
 

Like Johan said, remember to set a guid on your page type otherwise renaming class will mess things up. If you check in admin you will see that you now have multiple page types (TechnologyInstructionPage and TechnologyInstruction) if you forgot to set that guid.

#229215
Oct 09, 2020 7:39
* 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.