Skip to content

Commit 91c51f6

Browse files
authored
Merge pull request #7221 from idseefeld/patch-1
Update block-list-editor.md
2 parents d71fd60 + 71c481f commit 91c51f6

File tree

1 file changed

+3
-3
lines changed
  • 16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor

1 file changed

+3
-3
lines changed

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/block-list-editor.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ Example:
148148
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
149149
@{
150150
var content = (ContentModels.MyElementTypeAliasOfContent)Model.Content;
151-
var settings = (ContentModels.MyElementTypeAliasOfSettings)Model.Settings;
151+
var settings = Model.Settings as ContentModels.MyElementTypeAliasOfContent; // Cast Model.Settings safely using 'as' to avoid null reference exceptions
152152
}
153153

154-
// Output the value of field with alias 'heading' from the Element Type selected as Content section
154+
@* Output the value of field with alias 'heading' from the Element Type selected as Content section *@
155155
<h1>@content.Value("heading")</h1>
156156
```
157157

158158
With ModelsBuilder:
159159

160160
```csharp
161-
// Output the value of field with alias 'heading' from the Element Type selected as Content section
161+
@* Output the value of field with alias 'heading' from the Element Type selected as Content section *@
162162
<h1>@content.Heading</h1>
163163
```
164164

0 commit comments

Comments
 (0)