Skip to content

Commit 08032fb

Browse files
author
Warren Buckley
committed
Update to use new JSON content schema from CMS core 8.7 for blocklist items
1 parent b61856b commit 08032fb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/BlockEditorValueConnector.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public string ToArtifact(object value, PropertyType propertyType, ICollection<Ar
5656
return null;
5757

5858
// get all the content types used in block editor items
59-
var allContentTypes = blockEditorValue.Data.Select(x => x.ContentTypeKey)
59+
var allContentTypes = blockEditorValue.Content.Select(x => x.ContentTypeKey)
6060
.Distinct()
6161
.ToDictionary(a => a, a =>
6262
{
@@ -77,7 +77,7 @@ public string ToArtifact(object value, PropertyType propertyType, ICollection<Ar
7777
dependencies.Add(new ArtifactDependency(contentType.GetUdi(), false, ArtifactDependencyMode.Match));
7878
}
7979

80-
foreach (var block in blockEditorValue.Data)
80+
foreach (var block in blockEditorValue.Content)
8181
{
8282
var contentType = allContentTypes[block.ContentTypeKey];
8383

@@ -126,7 +126,7 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
126126
if (blockEditorValue == null)
127127
return value;
128128

129-
var allContentTypes = blockEditorValue.Data.Select(x => x.ContentTypeKey)
129+
var allContentTypes = blockEditorValue.Content.Select(x => x.ContentTypeKey)
130130
.Distinct()
131131
.ToDictionary(a => a, a =>
132132
{
@@ -141,7 +141,7 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
141141
throw new InvalidOperationException($"Could not resolve these content types for the Block Editor property: {string.Join(",", allContentTypes.Where(x => x.Value == null).Select(x => x.Key))}");
142142
}
143143

144-
foreach (var block in blockEditorValue.Data)
144+
foreach (var block in blockEditorValue.Content)
145145
{
146146
var contentType = allContentTypes[block.ContentTypeKey];
147147

@@ -194,11 +194,11 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
194194
/// "layout": {
195195
/// "Umbraco.BlockList": [
196196
/// {
197-
/// "udi": "umb://element/b401bb800a4a48f79786d5079bc47718"
197+
/// "contentUdi": "umb://element/b401bb800a4a48f79786d5079bc47718"
198198
/// }
199199
/// ]
200200
/// },
201-
/// "data": [
201+
/// "contentData": [
202202
/// {
203203
/// "contentTypeKey": "5fe26fff-7163-4805-9eca-960b1f106bb9",
204204
/// "udi": "umb://element/b401bb800a4a48f79786d5079bc47718",
@@ -222,14 +222,15 @@ public class BlockEditorValue
222222
/// <summary>
223223
/// This contains all the blocks created in the block editor.
224224
/// </summary>
225-
[JsonProperty("data")]
226-
public IEnumerable<Block> Data { get; set; }
225+
[JsonProperty("contentData")]
226+
public IEnumerable<Block> Content { get; set; }
227227
}
228228

229229
public class Block
230230
{
231231
[JsonProperty("contentTypeKey")]
232232
public string ContentTypeKey { get; set; }
233+
233234
[JsonProperty("udi")]
234235
public string Udi { get; set; }
235236

0 commit comments

Comments
 (0)