Web part inheritance

Web part inheritance allows you to create a web part that has the same properties and uses the same code as the original web part, but it has different default values. It means you can create specialized web part from a general one.

 

For example: You can create a News list web part inherited from the Repeater web part that will display a list of news by default. The default values can be later modified for any other value, but the inherited (specialized) web part allows you to do things faster.

 

How to create an inherited web part

 

1.Go to Site Manager -> Development -> Web parts, click Listings and viewers and click New web part.
 
2.Click Inherit from an existing web part and enter the following values:
- Web part display name: News list
- Web part code name: NewsList
- Inherit from: Listings and viewers/Repeater
Click OK.
 
3.Click the Properties tab of the newly created web part. Here you can see the properties of the parent web part and you can override their default values by clearing the Inherited box and entering a new default value. Enter the following default values:
- Path: /%
- Document types: cms.news
- ORDER BY expression: NewsReleaseDate
- Transformation: cms.news.preview
- Selected item transformation: cms.news.default
 
Click OK.
 
clip0634
 
4.Go to CMS Desk, choose the Home page in the content tree and switch to the Design tab. Add the News list web part to the page. It will display all site news without any additional configuration now.