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.
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" )
.LocalizeUsing<MyCustomModuleResources>()
.SetTitleLocalized( "ModuleTitle" )
.SetUrlNameLocalized( "MyCustomModuleUrlName" )
.SetDescriptionLocalized( "MyCustomModuleDescription" )
.SetHtmlTitleLocalized( "MyCustomModuleHtmlTitle" )
.AddControl( myControl )
.Done()
.Done()
.RegisterControlTemplate<MasterView>( myTemplateName, myViewName );
}