Skip to content

Commit bc43ff5

Browse files
authored
Merge pull request #7289 from umbraco/cms/legacy-nested-content
Adds note on legacy block grid for support with update to block list
2 parents cf1eb2e + cdab8c8 commit bc43ff5

File tree

1 file changed

+12
-10
lines changed
  • 10/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors

1 file changed

+12
-10
lines changed

10/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/nested-content.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
We highly recommend that you use the [Block List](block-editor/block-list-editor.md) instead.
55

66
Nested Content has been marked as obsolete and development on the property editor has been discontinued.
7+
8+
[Umbraco Deploy](https://docs.umbraco.com/umbraco-deploy/deployment-workflow/import-export/import-with-migrations) and [uSync migrations](https://github.com/Jumoo/uSyncMigrations) have support for migrating from nested content to the block list.
79
{% endhint %}
810

911
`Alias: Umbraco.NestedContent`
@@ -106,7 +108,7 @@ Example:
106108
// Render your content, e.g. item.Value<string>("heading")
107109
}
108110
}
109-
111+
110112
}
111113
```
112114

@@ -176,31 +178,31 @@ Afterwards, the entire list needs to be serialized to Json via JsonConvert.
176178
@using Newtonsoft.Json;
177179
@inject IContentService _contentService;
178180

179-
//if the class containing our code inherits SurfaceController, UmbracoApiController,
181+
//if the class containing our code inherits SurfaceController, UmbracoApiController,
180182
//or UmbracoAuthorizedApiController, we can get ContentService from Services namespace
181-
var contentService = _contentService;
183+
var contentService = _contentService;
182184
//here we create a new node, and fill out attendeeList afterwards
183-
IContent request = contentService.Create("new node", guid, "mydoctype", -1);
185+
IContent request = contentService.Create("new node", guid, "mydoctype", -1);
184186
//our list which will contain nested content
185-
var attendees = new List<Dictionary<string, string>>();
187+
var attendees = new List<Dictionary<string, string>>();
186188
//participants is our list of attendees - multiple items, good use case for nested content
187-
foreach (var person in participants)
189+
foreach (var person in participants)
188190
attendees.Add(new Dictionary<string, string>() {
189191
//this is the only "default" value we need to fill for nested item
190-
{"ncContentTypeAlias","attendee"},
192+
{"ncContentTypeAlias","attendee"},
191193
{"user_name", person.name},
192194
{"user_email",person.user_email},
193-
{"join_time",person.join_time.ToString()},
195+
{"join_time",person.join_time.ToString()},
194196
//we convert some properties to String just to be on the safe side
195197
{"leave_time",person.leave_time.ToString()},
196198
{"duration",person.duration.ToString()},
197199
{"phone",person.phone.ToString()}
198200
});
199201
}
200202
//bind the attendees List to attendeeList property on the newly created content node
201-
request.SetValue("attendeeList", JsonConvert.SerializeObject(attendees));
203+
request.SetValue("attendeeList", JsonConvert.SerializeObject(attendees));
202204
//Save the entire node via ContentService
203-
ContentService.SaveAndPublish(request);
205+
ContentService.SaveAndPublish(request);
204206
```
205207

206208
In the above sample we iterate through a list of participants (the data for such participants could be coming from an API, for example), and add a new `Dictionary` item for each person in the list.

0 commit comments

Comments
 (0)