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

Forums / General Discussions / Custom Module to select pages.

Custom Module to select pages.

11 posts, 0 answered
  1. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    15 Apr
    Link to this post
    Hello, I need a little of help, I have several widgets and each of this widgets have to be configured with the same page for example shopping cart page. I want to create a  custom module in where the user could set the shopping cart page and  each of the created widgets take that page as  a default page. I don't know if this can be done with a custom module  or if anyone can give a little idea of how i can do that.
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    15 Apr in reply to Edwin
    Link to this post

    Is use a configuration section to store all my common settings. 

    I think you can make one easy with Thunder... Or this... 

    http://docs.sitefinity.com/for-developers-create-a-new-configuration

     

  3. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    18 Apr in reply to Steve
    Link to this post
    Thanks for yours suggestions Steve. The problem is that we can not use thunder here. And your opinion about use a configuration section i think that doesn't works because we don't know the name of the pages that are created. The first thing that i have to do is that the user create his own pages and then he can use the custom module to select the page where he have the shopping cart widget "for example".
  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    18 Apr in reply to Edwin
    Link to this post

    Configuration section is exactly where this should be set, it's the common backend place where all modules store their data... you would store the PageId in it...

    Example: /Sitefinity/Administration/Settings/Advanced/Project (Click DefaultSite)
    So this is where you can tell the login widgets where the frontend page is (url or ID) if the user needs to be authenticated...

    Can you elaborate a bit on what you're doing though?  Custom Module as in custom coded, or Module Builder, etc etc?

  5. Dave
    Dave avatar
    29 posts
    Registered:
    27 Aug 2010
    18 Apr
    Link to this post

    To be honest I'don't entirely follow what you are trying to achieve. With that said, what if you created a custom module and used that to store the settings. You could then update the settings in the custom module when a page is created.

    Or you could manually create a table in the Sitefinity database for storing the settings. You would than write your own code for querying and updating the settings.

    Actually there is no reason the same approach could not be applied to Steve's suggestion of creating a custom configuration. I'm pretty sure that the custom configuration can be saved to using the API. So you could update the custom configration after a page has been saved.

  6. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    20 Apr
    Link to this post

    Hello, I finally could do the thing that i want, but now i had a problem, can anyone tell me how i can do a label for put in the main section of the module and also and multiline input for comments? Using a sintax as the below sintax, to this multiline and label appear when the custom module is installed

       var titleField = new TextFieldDefinitionElement(mainSection.Fields)
                 {
                     ID = "titleFieldControl",
                     DataFieldName = displayMode == FieldDisplayMode.Write ? "Title.PersistedValue" : "Title",
                     DisplayMode = displayMode,
                     Title = "Page Name",
                     CssClass = "sfTitleField",
                     WrapperTag = HtmlTextWriterTag.Li,
                 };

    I don't want use the Description property to put "IsRequired", I want put "IsRequired" down the select page field

  7. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    20 Apr in reply to Dave
    Link to this post
    Hello, I finally could do the thing that i want, but now i had a problem, can anyone tell me how i can do a label for put in the main section of the module and also and multiline input for comments? Using a sintax as the below sintax, to this multiline and label appear when the custom module is installed
       var titleField = new TextFieldDefinitionElement(mainSection.Fields)
                 {
                     ID = "titleFieldControl",
                     DataFieldName = displayMode == FieldDisplayMode.Write ? "Title.PersistedValue" : "Title",
                     DisplayMode = displayMode,
                     Title = "Page Name",
                     CssClass = "sfTitleField",
                     WrapperTag = HtmlTextWriterTag.Li,
                 };
    I don't want use the Description property to put "IsRequired", I want put "IsRequired" down the select page field
  8. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    20 Apr in reply to Steve
    Link to this post
    Hello, I finally could do the thing that i want, but now i had a problem, can anyone tell me how i can do a label for put in the main section of the module and also and multiline input for comments? Using a sintax as the below sintax, to this multiline and label appear when the custom module is installed
       var titleField = new TextFieldDefinitionElement(mainSection.Fields)
                 {
                     ID = "titleFieldControl",
                     DataFieldName = displayMode == FieldDisplayMode.Write ? "Title.PersistedValue" : "Title",
                     DisplayMode = displayMode,
                     Title = "Page Name",
                     CssClass = "sfTitleField",
                     WrapperTag = HtmlTextWriterTag.Li,
                 };
    I don't want use the Description property to put "IsRequired", I want put "IsRequired" down the select page field
  9. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    21 Apr
    Link to this post
    Someone can helpme?
  10. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    21 Apr
    Link to this post
    I'm sorry, I have no experience with Custom Modules :/  I do everything I can through the Dynamic Types and the Module builder (safer and easier IMO).
  11. Pavel Benov
    Pavel Benov avatar
    21 posts
    Registered:
    29 Nov 2016
    28 Apr
    Link to this post
    Hello Edwin,

    I would have to agree with Steve on this one. Module builder's dynamic modules are safer and easier to create, + they expose many hooks where you can plug in custom logic.

    If you decide to continue with the custom static module you can check the following forum thread on how to add comments to a static module:

    http://www.sitefinity.com/developer-network/forums/general-discussions-/how-to-add-commets-in-my-custom-module

    On the positioning of the "IsRequired" text - You can use the Example property in the constructor of your PageFieldDefinition. The Example's markup is placed below the page selector button. Here is a sample extracted from the Blogs definitions with Example field added:

    var defaultPage = new PageFieldElement(mainSection.Fields)
                {
                    Title = "DefaultPage",              
                    ResourceClassId = typeof(BlogResources).Name,
                    ID = "defaultPage",
                    FieldName = "DefaultPageId",
                    DataFieldName = "DefaultPageId",
                    DisplayMode = FieldDisplayMode.Write,
                    WebServiceUrl = "~/Sitefinity/Services/Pages/PagesService.svc/",
                    CssClass = "sfFormSeparator",
                    Example = "IsRequired",
                };
                mainSection.Fields.Add(defaultPage);

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
11 posts, 0 answered