Register new widgets in Sitefinity CMS toolbox

After you implement new widgets, you must register them in the Sitefinity CMS toolbox. You do this by decorating the widget controller class with the ControllerToolboxItem attribute. This attribute defines the following properties of the widget:

Property Description  Required 
Name  The unique developer name of the widget, for example, ContentBlock_MVC Yes
Title The display name of the widget, visible in the widget toolbox, for example, Content block. Yes
SectionName 

The unique developer name of the toolbox section, in which you add the widget. This can be an existing section name. To find out the names of existing sections, go to the ~/Sitefinity/Administration/Settings/Advanced/Toolboxes folder and expand the PageControls » Sections nodes. For example, you can add your new widget to the ContentToolboxSection, defined as the constant ToolboxesConfig.ContentToolboxSectionName.

You can also create a new section and Sitefinity CMS will automatically create toolbox section with the name you have specified.

Yes 
ModuleName  The unique name of a Sitefinity module that has to be explicitly activated, so that you can see the widget in the toolbox. You can see the names of modules by navigating to the ~/Sitefinity/Administration/Settings/Advanced/System folder and expanding ApplicationModules. No 
Toolbox

The unique developer name of the toolbox, in which you register the widget. By default, this is the page controls toolbox PageControls (the constant ToolboxesConfig.PageControlsToolboxName).
You can also specify another toolbox name. Examples:
- When developing MVC form fields, you use FormControls or the constant FormsConstants.FormControlsToolboxName
- When developing MVC widgets for message templates, you use NewsletterControls or the constant ToolboxesConfig.NewslettersControlsToolboxName

No

IMPORTANT: Required when developing MVC form fields and MVC widgets for email campaigns.

CssClass This property enables you to control the styles of the toolbox item. The widget controller must implement either the ICustomWidgetVisualization interface or the ICustomWidgetVisualizationExtended interface. These interfaces enable you to use special styles in the toolbox and when dropping an empty widget on a page. No 

For more information about new widgets, see Create widgets.

For an example of how to implement a Content Block widget controller, take a look at the GitHub repository.

Sitefinity CMS automatically detects all widget controllers that are decorated with the ControllerToolboxItem attribute and adds the corresponding item to the widget toolbox.

The following sample demonstrates how to decorate the widget controller with the ControllerToolboxItem attribute:

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?