Add an overload to GetDictionaryValue to provide a fallback - U4-8657

This commit is contained in:
Marc Goodson
2016-06-25 10:54:10 +01:00
parent 374fa5b574
commit 29e45534c5

View File

@@ -375,7 +375,21 @@ namespace Umbraco.Web
{
return CultureDictionary[key];
}
/// <summary>
/// Returns the dictionary value for the key specified, and if empty returns the specified default fall back value
/// </summary>
/// <param name="key">key of dictionary item</param>
/// <param name="altText">fall back text if dictionary item is empty - Name altText to match Umbraco.Field</param>
/// <returns></returns>
public string GetDictionaryValue(string key, string altText)
{
var dictionaryValue = GetDictionaryValue(key);
if (String.IsNullOrWhiteSpace(dictionaryValue))
{
dictionaryValue = altText;
}
return dictionaryValue;
}
/// <summary>
/// Returns the ICultureDictionary for access to dictionary items
/// </summary>