|
||
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 has different default property values. It means you can create a 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 later be modified to any other value, but the inherited (specialized) web part allows you to do things faster.
1. Go to Site Manager -> Development -> Web parts, select the Listings and viewers category and click New web part.
2. Choose Inherit from an existing web part and enter the following values:
•Display name: Custom news list
•Code name: CustomNewsList
•Inherit from: Listings and viewers/Documents/Repeater
Click Save.
3. Switch to 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 Save.
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 now display all site news without any additional configuration.