Add Property to Block/Page Type

A
A
Vote:
 

Hi,

Ref: http://webhelp.episerver.com/latest/cms-admin/properties.htm

In the cms, if i go to admin > content type, I am able to add properties to existing page/block types.

In the scenario a content editor wants to do this, how do these newly added properties get rendered on the page if they're not part of the razor template?

#191713
Edited, Apr 26, 2018 23:49
Vote:
 

They will not be rendered on the page. There is many metadata properties like sortorder, publish dates etc that typically dont get rendered. You can however in code like in a controller have logic that is based on the value of such metadata properties.

#191737
Apr 27, 2018 8:44
Vote:
 

In the modern versions of Episerver 7+ all properties should be added via code, they should never be added in the admin backend. The feature still exists as a legacy area, mainly the type view is uses to delete properties that have been removed from code and to check the settings. Adding properties should only ever be done by a developer, in code.

#191751
Apr 27, 2018 11:46
Vote:
 

CC, please read more about how to do this by code here:
https://world.episerver.com/documentation/developer-guides/CMS/Content/

Also install the Visual Studio extension found here: 

https://marketplace.visualstudio.com/items?itemName=EPiServer.EpiserverCMSVisualStudioExtension

Then create a demosite (Create new project and include Alloy through the episerver menu item) and look how it is done there

Good luck!

#191753
Apr 27, 2018 12:16
A
Vote:
 

So, it sounds like before Episerver 7 there was a way to do this, and in current version this is no longer supported.

Is this correct?

#191792
Apr 27, 2018 19:31
Vote:
 

Yes. Back then we used PageTypeBuilder to get properties etc to get synchronized with code (so that we didn't need to do that by hand which is/was error prone).

As Scott already said, you shouldn't be using admin to modify these but have them in code (you get your changes to different environments automatically when you deploy code, that is the way to do it).

#191793
Edited, Apr 27, 2018 20:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.