Way to implement generic content based module

Posted by Community Admin on 03-Aug-2018 15:57

Way to implement generic content based module

All Replies

Posted by Community Admin on 26-Oct-2010 00:00

Hi,

I'm trying to create generic content based module, which should inherit most of its functionality (categories, tags) from generic content and ideally should look as native Sitefinity module (UI backend).

I saw Jobs sample module which uses it's own ascx template for backend. On the other side there are classes in each native module like (e.g. for Forms) FormsManager, FormsModule, FormsResources etc. which extend ContentModuleBase, ManagerBase.. etc and which use embedded templates and controls.

I'm just wondering, can I reuse embedded resources (controls, templates) for my module so it will look similiar to native module or will it be too much coding? I'm not sure how are those components coupled together..

Thanks,
Robert

 


Posted by Community Admin on 26-Oct-2010 00:00

Hi Robert,

There is a method InstallPages that you can override and set the template that your backend pages will use

protected override void InstallPages(SiteInitializer initializer)
        
            var pageManager = initializer.PageManager;
            var moduleNode = pageManager.GetPageNode(SiteInitializer.ModulesNodeId);
            var id = ModulePageGroupId;
          ...
                    ...
            if (modulePageGroup == null)
            
                modulePageGroup = initializer.CreatePageNode(ModulePageGroupId, moduleNode);
                modulePageGroup.Name = "CustomModule";
                modulePageGroup.ShowInNavigation = true;
               
            
  
            id = this.LandingPageId;
            var landingPage = pageManager.GetPageNodes().SingleOrDefault(p => p.Id == id);
            if (landingPage == null)
            
                var pageInfo = new PageElement()
                
                    PageId = this.LandingPageId,
                    Name = "CustomModule",
                    MenuName = "ModuleTitle",
                    UrlName = "CustomModuleUrlName",
                    Description = "CustomModuleDescription",
                    HtmlTitle = "CustomModuleHtmlTitle",
                    ResourceClassId = ResourceClassId,
                    IncludeScriptManager = true,
                    ShowInNavigation = false,
                    EnableViewState = false,
                    TemplateName = SiteInitializer.BackendTemplateName
                ;
                var controlPanel = new BackendContentView()
                
                    ModuleName = CustomModule.ModuleName,
                    ControlDefinitionName = CustomModuleDefinitions.BackendDefinitionName
                ;
                initializer.CreatePageFromConfiguration(pageInfo, modulePageGroup, controlPanel);
            
  
  ...

We are working on a custom module that illustrates how you can inherit from a built-in module like Content and reuse its views.

All the best,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed