Skip to content

Commit d228ee5

Browse files
committed
Fix Razor code samples
1 parent 67f3e6f commit d228ee5

File tree

1 file changed

+35
-4
lines changed
  • 16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors

1 file changed

+35
-4
lines changed

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/multi-url-picker.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ These can either be internal, external or media.
1717

1818
## Content Example
1919

20-
![Media Picker Content](../../../../../../10/umbraco-cms/fundamentals/backoffice/property-editors/built-in-property-editors/images/Multy-Url-Picker-Content-v8.png)
20+
![Multi Url Picker Content](images/Multi-Url-Picker-Content.png)
2121

22-
## MVC View Example - value converters enabled
22+
## MVC View Example
2323

24-
## Typed
24+
### Without Models Builder
2525

2626
```csharp
2727
@using Umbraco.Cms.Core.Models
@@ -39,7 +39,7 @@ These can either be internal, external or media.
3939
}
4040
```
4141

42-
If `Max number of items` is configured to `1`
42+
This example handles the case of `Maximum number of items` set to `1`:
4343

4444
```csharp
4545
@using Umbraco.Cms.Core.Models
@@ -52,6 +52,37 @@ If `Max number of items` is configured to `1`
5252
}
5353
```
5454

55+
### With Models Builder
56+
57+
```csharp
58+
@{
59+
var links = Model.FooterLinks;
60+
if (links.Any())
61+
{
62+
<ul>
63+
@foreach (var link in links)
64+
{
65+
<li><a href="@link.Url" target="@link.Target">@link.Name</a></li>
66+
}
67+
</ul>
68+
}
69+
}
70+
```
71+
72+
And here's the case of `Maximum number of items` set to `1`:
73+
74+
```csharp
75+
@{
76+
var link = Model.Link;
77+
if (link != null)
78+
{
79+
<a href="@link.Url" target="@link.Target">@link.Name</a>
80+
}
81+
}
82+
```
83+
84+
85+
5586
## Add values programmatically
5687

5788
See the example below to see how a value can be added or changed programmatically. To update a value of a property editor you need the [Content Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.ContentService.html).

0 commit comments

Comments
 (0)