Customize the default view of widgets through widget definitions
Widget definitions, or, control definitions in Sitefinity CMS are a developer concept that enables building structured declarative user interfaces. They facilitate reuse of components when building the backend user interface (UI) and also enable third-party developers to plug their own components to extend that UI. For more information about definitions, see For developers: Build the backend UI with Control definitions.
Sitefinity's ContentView class and all its inheritors (widgets such as News, Blog Posts, Events, and so on) are important elements that build the Sitefinity CMS experience. They enable you to select the data you want to display, as well as data's behavior on the frontend.
Each widget definition consists of views for the backend and the frontend that represent a specific UI, for example for actions like Edit, Insert, View Preview, and so on. In some cases, you need to extend the default functionality the UI views for the needs of a more complex scenario. To do that, you need to replace the default view with your custom one through the widget definitions.
This article demonstrates how to inherit from a ContentView class and directly manipulate its DataSource property to result in frontend filtering in any News widget. As every other widget that is derived from the ContentView class, the widget derived from the NewsView class also has a Master and a Details view. Since you want to filter the list of items displayed by the widget, you need to modify the News widget List of news template and inherit from its MasterView class.
You can download and set the template and map the new template to the News widget. Alternatively, you can do the whole procedure from scratch.