Custom basic settings for multisite

Posted by Community Admin on 04-Aug-2018 20:45

Custom basic settings for multisite

All Replies

Posted by Community Admin on 09-Mar-2016 00:00

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. codeengage.com/.../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.

Posted by Community Admin on 14-Mar-2016 00:00

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. 

www.sitefinitytipsandtricks.net/.../

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
 

Posted by Community Admin on 14-Mar-2016 00:00

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

Posted by Community Admin on 15-Mar-2016 00:00


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

See: www.sitefinity.com/.../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>()

Posted by Community Admin on 20-Jan-2017 00:00

Hi Chris,

I have read the link that you have shared and I noticed that the sample was in classic web form implementation. Do you have any sample implementation on MVC?

Yong Kit

This thread is closed