1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Way to implement generic content based module

Way to implement generic content based module

2 posts, 0 answered
  1. Robert
    Robert avatar
    70 posts
    Registered:
    05 Feb 2009
    26 Oct 2010
    Link to this post
    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

     


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    26 Oct 2010
    Link to this post
    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
2 posts, 0 answered