IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
Sitefinity CMS enables you to use the Fluent API when installing a module.
When using the Fluent API to install a module, you use the module install facade.
To get the module install facade, use App.WorkWith().Module(moduleName, pageManager).Install().
The ModuleInstallFacade class provides the following methods:
CreateModuleGroupPage - provides Fluent API for creating a new module node. The method accepts the ID and the name of the module node. It returns a module node facade that you use to create the node.
CreateModulePage - provides Fluent API for creating a new module page. The method accepts the ID and the name of the module page. It returns a module page facade that you use to create the page.
RegisterControlTemplate - registers a control template.
You use the module node facade to create a module node.
The ModuleNodeFacade class allows you to:
set the title, URL name and description of the node
control the visibility of the node
set the order and parent of the node
add and remove attributes
add child groups or pages
To add a page to the node, you use the module page facade.
You use the module page facade to create a module page.
The ModulePageFacade class allows you to:
set the title, URL name and description of the page
include or exclude script managers
control the visibility of the page
set the order, parent and template of the page
add controls to the page
This example installs the custom module by creating the module node and page:
protected
override
void
InstallPages( SiteInitializer initializer )
{
App.WorkWith()
.Module(
"MyCustomModule"
, initializer.PageManager )
.Install()
.CreateModuleGroupPage( MyCustomModulePageGroupId,
"MyCustomModulePageGroupName"
)
.PlaceUnder( CommonNode.TypesOfContent )
.SetOrdinal( 1 )
.LocalizeUsing<MyCustomModuleResources>()
.SetTitleLocalized(
"ModuleTitle"
.SetUrlNameLocalized(
"PageGroupNodeTitle"
.SetDescriptionLocalized(
"PageGroupNodeDescription"
.AddChildPage( MyCustomModuleHomePageId,
"MyCustomModuleHomePageName"
"MyCustomModuleUrlName"
"MyCustomModuleDescription"
.SetHtmlTitleLocalized(
"MyCustomModuleHtmlTitle"
.AddControl( myControl )
.Done()
.RegisterControlTemplate<MasterView>( myTemplateName, myViewName );
}
You place your code in the InstallPages override method. First, you get the module installation facade. You create the module node and specify its properties and placement. Then, you create the module home page and its properties and add a control to the page. Finally, you register the control template.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important