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

Forums / Developing with Sitefinity / Custom basic settings for multisite

Custom basic settings for multisite

4 posts, 0 answered
  1. Glen
    Glen avatar
    2 posts
    Registered:
    24 Apr 2015
    09 Mar
    Link to this post

    Greetings

    We are using the multisite feature and have the need to create settings that can be controlled in the Admin back end on a per site basis. This should function like the existing ones - Time zone, Social sharing and Sitemap - in that you can break inheritance from global settings for each individual site.

    I have found this example on how to do basic settings and configurations. http://codeengage.com/blog/craig-holdheide/2014/11/03/getting-started-with-sitefinity-basic-settings-and-configurations

    Is there something that could be changed in that example that would allow for custom settings to be managed on a per site basis? Or is there another approach to doing that?

    Thanks.

  2. Chris
    Chris avatar
    3 posts
    Registered:
    23 Sep 2016
    14 Mar
    Link to this post
    Hello,

    So one thing you may have missed in that article was in override the initialize method.

     and a Boolean value to determine whether the Basic Settings are global (false) or per site (true).

    There is also another article I think handles this a little better. 

    http://www.sitefinitytipsandtricks.net/2015/11/22/create-custom-basic-settings-section/

    In this case the setting is in SystemManager.RegisterBasicSettings("GoogleMaps", "GoogleMaps", "CustomResources", false);

    That final false is the flag to be set for multisite. Let me know if this helps and if not we can get back and I will see what I can get set up on my end.

    Regards,
    Chris
    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
     
  3. Glen
    Glen avatar
    2 posts
    Registered:
    24 Apr 2015
    14 Mar
    Link to this post

    Hi Chris

    Thanks, I definitely missed that part of the article. It does show up in the per site section now, and reads/writes the setting just fine.

    However, I am having a problem reading the setting from widget code. I use this.

    var config = Config.Get<MyModuleConfig>();
    model.Message = config.ExampleConfigProperty;

    This is pulling the value from the global setting, not the value that was explicitly overridden in the admin UI for the site.

    Glen

  4. Chris
    Chris avatar
    3 posts
    Registered:
    23 Sep 2016
    15 Mar
    Link to this post

    The basic way to do this in the current context with with the system manager.

    See: http://www.sitefinity.com/developer-network/forums/general-discussions-/multisite-custom-field

    There are a few code samples in that thread that hit the high points in using SystemManager and getting settings from the current context.

    SystemManager.CurrentContext.GetSetting<CustomContract, CustomContract>()
4 posts, 0 answered