Custom basic settings for multisite
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.
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
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
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>()
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