Custom modules
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.
Create a custom module
Each Sitefinity CMS module has to inherit from ModuleBase
and override the Install
method. In it, add the logic for the actions the module will perform when getting added to a Sitefinity CMS site. In this case, the module creates a backend page trough which it will be accessed and it adds ContentBlock widget to that page with some text.
EXAMPLE: To create general purpose module in Sitefinity CMS, refer to the sample module that creates sitemap by registering HTTP handler:
https://github.com/Sitefinity/Telerik.Sitefinity.Samples.Sitemap
Following is a list of some of the methods used:
GetModuleConfig()
This is a mandatory method for creating specific configuraton for the module. In this sample, no configuration will be created for the module.
Managers
It is mandatory to create a manager for the module that does allow it to have its own API. In this case no manager is created.
Upgrade
These are optional actions that the module will do when the module is upgraded
LandingPageId
This is a mandatory property that is used to retrieve the main backend page for the module.
Install
This is a mandatory method that provides the logic for installing the prerequisite data for the module functionality.
Install the module
- In Sitefinity backend, navigate to Administration Modules & Services.
- Click Install a module and fill out the following fields:
- In Name, enter SimpleModule
- In Type, enter SitefinityWebApp.Modules.SimpleModule
This is the above CLR type of the class for the module.
- In Start module... select radio button, select When the whole application is opened for first time.
- To install the module, click Save.
NOTE: A Sitefinity module may be functional without creating a page trough which the module is accessible