Custom modules

Overview

Sitefinity CMS comes with a set of built-in modules, which can be directly used in the pages you create. You can also create your own custom modules and use them side by side with the default ones.

NOTE: Depending on your use case scenario, the officially recommended approach whether to proceed by creating a custom module is as follows:
  • For modules that extend the out-of-the-box functionality of Sitefinity CMS, such as adding integration, widgets, logic, and so on, use custom modules.
  • If you want to define new content types in Sitefinity CMS, use the Module Builder.
    For more information, see Dynamic modules and the Module Builder.

Create a custom module

Each Sitefinity CMS module must inherit from the ModuleBase class and override the Install method. In it, add the logic for the actions the module performs when getting added to a Sitefinity CMS site. For example, registering some configuration, creating backend pages, adding widgets and so on.

You can leverage the Sitefinity VSIX and CLI tools to get started with building custom modules. Both Sitefinity VSIX and Sitefinity CLI enable you to add a new custom module project with the necessary scaffolded module classes, containing inline guidance.

EXAMPLE: To create a general purpose module in Sitefinity CMS, with minimum implementation effort, refer to the sample Database diagnostic module. The module class contains inline documentation for each method used and can guide you into the purpose of each of them.

Install the module

To facilitate modules decoupling, Sitefinity CMS provides an easy mechanism for installing modules automatically. This way, you can create custom modules, which are installed automatically upon Sitefinity CMS startup. For your module to be discovered and auto-installed at startup, you need to mark it with  the SitefinityModuleAttribute assembly attribute.

While the website is initializing, Sitefinity CMS looks for assemblies in the /bin folder, containing modules marked with this attribute and installs them. The SitefinityModuleAttribute requires you to specify your module name, type, title, description, startup type, module ID, and resource class ID if applicable. 

Implement custom modules

In addition to the full implementation of the Database diagnostic module, discussed above, below you can find below an example of a dummy Sitefinity module that you can use as a scaffolding for your custom implementations if you prefer to start from scratch:

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

Modules settings