Extend the built-in widgets

Overview

Sitefinity ASP.NET Core Renderer comes with a set of built-in widgets, such as Navigation, Content list, and Content block. You can extend these widgets to suit your requirements in the following ways:

  • Customize the views of the widgets
  • Modify the logic behind the widgets
  • Add fields to the widget designer

Source code of built-in widgets

When you want to extend a built-in widget, you may need its source code.

Sitefinity provides the source code of all built-in widgets, including all forms widgets in Sitefinity's GutHub repository » ASP.NET Core widgets.

Customize the views for the widgets

You can add new or override the existing widget views.

You can do this by placing the file in the directory of your root web application using the following convention:
/Views/Shared/Components/{WIDGET_NAME}/{VIEW_NAME}.cshtml

Where:

  • WIDGET_NAME is the name of the widget where the view will be added or overridden.
    For example, SitefinityContentBlock, SitefinityNavigation, or SitefinityContentList.
  • VIEW_NAME is the name of the view you want to add or override.
NOTE: You can customize the widget templates for widgets that refer their own scripts, such as the Search box widget. In this case, you need to add the following using statements to the template:

Modify the logic behind the widgets

You can modify the default or add custom logic to the behavior of a built-in widget by replacing a class in the .NET DI Container.

This is the Model class that all ASP.NET Core widgets have – for example, IContentBlockModel, IContentListModel, or ISectionModel.
You can see all registered Model classes in the WidgetCollectionExtensions.cs class.

Add fields to the widget designers

You can include additional fields in the widget designer.
You do this by extending the default Entity class that serves as the metadata source for the automatic generation of widgets.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Custom widgets