Last active
February 16, 2021 10:25
-
-
Save trnktms/c1d357b4dc2755d2cfdde43d5fb28a52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class SettingsUtil | |
{ | |
// 1. Instead of Factory.GetConfigNode(customConfigNode) | |
public XmlNode GetConfigNode(string customConfigNode) | |
{ | |
return ConfigReader.GetConfiguration().SelectSingleNode($"sitecore/{customConfigNode}"); | |
} | |
// 2. Instead of Settings.GetSetting(name) | |
public string GetSetting(string name) | |
{ | |
var node = ConfigReader.GetConfiguration().SelectSingleNode($"sitecore/settings/setting[@name='{name}']"); | |
if (node == null) | |
{ | |
return null; | |
} | |
return node.Attributes["value"].Value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment