Merge pull request #1360 from marcemarc/dev-u4-8657
Closes Issue U4-8657 - Add an overload to GetDictionaryValue to provide fallback text
This commit is contained in:
@@ -376,7 +376,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>
|
||||
|
||||
Reference in New Issue
Block a user