Skip to content

Commit 0daf631

Browse files
authored
Merge pull request #7402 from umbraco/v16/cms/umbracohelper-dictionaryvalue
CMS: adds explanation for `GetDictionaryValueOrDefault`
2 parents 2be50c6 + 45e987f commit 0daf631

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

16/umbraco-cms/reference/querying/umbracohelper.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ Previously the `UmbracoHelper` could be used to run queries on your content, thi
132132

133133
Returns a dictionary value(`string`) for the key specified.
134134

135-
```html
135+
```cshtml
136136
<p>@Umbraco.GetDictionaryValue("createdOn"): @Model.CreateDate</p>
137137
```
138138

139+
### .GetDictionaryValueOrDefault(string key, string altText)
139140
Alternatively, you can also specify an `altText` which will be returned if the dictionary value is empty.
140141

141-
```html
142-
<p>@Umbraco.GetDictionaryValue("createdOn", "Date Created"): @Model.CreateDate</p>
142+
```cshtml
143+
<p>@Umbraco.GetDictionaryValueOrDefault("createdOn", "Date Created"): @Model.CreateDate</p>
143144
```

0 commit comments

Comments
 (0)