From 809826420658691952a2fb28997d9fbe1106d848 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 21 Jul 2020 13:28:19 +1000 Subject: [PATCH] WIP --- .../Models/Blocks/BlockListLayoutReference.cs | 32 ++++++++++++------- .../Models/Blocks/IBlockReference.cs | 2 +- .../BlockListPropertyValueConverterTests.cs | 10 +++--- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Core/Models/Blocks/BlockListLayoutReference.cs b/src/Umbraco.Core/Models/Blocks/BlockListLayoutReference.cs index 19b30e6ea6..ed3f46db70 100644 --- a/src/Umbraco.Core/Models/Blocks/BlockListLayoutReference.cs +++ b/src/Umbraco.Core/Models/Blocks/BlockListLayoutReference.cs @@ -10,32 +10,42 @@ namespace Umbraco.Core.Models.Blocks [DataContract(Name = "blockListLayout", Namespace = "")] public class BlockListLayoutReference : IBlockElement { - public BlockListLayoutReference(Udi udi, IPublishedElement data, IPublishedElement settings) + public BlockListLayoutReference(Udi contentUdi, IPublishedElement content, Udi settingsUdi, IPublishedElement settings) { - Udi = udi ?? throw new ArgumentNullException(nameof(udi)); - Data = data ?? throw new ArgumentNullException(nameof(data)); + ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi)); + Content = content ?? throw new ArgumentNullException(nameof(content)); Settings = settings; // can be null + SettingsUdi = settingsUdi; // can be null } /// - /// The Id of the data item + /// The Id of the content data item /// - [DataMember(Name = "udi")] - public Udi Udi { get; } + [DataMember(Name = "contentUdi")] + public Udi ContentUdi { get; } /// - /// The settings for the layout item + /// The Id of the settings data item /// - [DataMember(Name = "settings")] - public IPublishedElement Settings { get; } + [DataMember(Name = "settingsUdi")] + public Udi SettingsUdi { get; } /// - /// The data item referenced + /// The content data item referenced /// /// /// This is ignored from serialization since it is just a reference to the actual data element /// [IgnoreDataMember] - public IPublishedElement Data { get; } + public IPublishedElement Content { get; } + + /// + /// The settings data item referenced + /// + /// + /// This is ignored from serialization since it is just a reference to the actual data element + /// + [IgnoreDataMember] + public IPublishedElement Settings { get; } } } diff --git a/src/Umbraco.Core/Models/Blocks/IBlockReference.cs b/src/Umbraco.Core/Models/Blocks/IBlockReference.cs index d63e5e4ca9..d1596b10bb 100644 --- a/src/Umbraco.Core/Models/Blocks/IBlockReference.cs +++ b/src/Umbraco.Core/Models/Blocks/IBlockReference.cs @@ -8,6 +8,6 @@ /// public interface IBlockReference { - Udi Udi { get; } + Udi ContentUdi { get; } } } diff --git a/src/Umbraco.Tests/PropertyEditors/BlockListPropertyValueConverterTests.cs b/src/Umbraco.Tests/PropertyEditors/BlockListPropertyValueConverterTests.cs index d2bc34e633..483b1d38cf 100644 --- a/src/Umbraco.Tests/PropertyEditors/BlockListPropertyValueConverterTests.cs +++ b/src/Umbraco.Tests/PropertyEditors/BlockListPropertyValueConverterTests.cs @@ -278,7 +278,7 @@ data: []}"; Assert.AreEqual(1, converted.Layout.Count()); var layout0 = converted.Layout.ElementAt(0); Assert.IsNull(layout0.Settings); - Assert.AreEqual(Udi.Parse("umb://element/1304E1DDAC87439684FE8A399231CB3D"), layout0.Udi); + Assert.AreEqual(Udi.Parse("umb://element/1304E1DDAC87439684FE8A399231CB3D"), layout0.ContentUdi); } [Test] @@ -326,12 +326,12 @@ data: []}"; Assert.AreEqual(2, converted.Layout.Count()); var item0 = converted.Layout.ElementAt(0); - Assert.AreEqual(Guid.Parse("1304E1DD-AC87-4396-84FE-8A399231CB3D"), item0.Data.Key); - Assert.AreEqual("Test1", item0.Data.ContentType.Alias); + Assert.AreEqual(Guid.Parse("1304E1DD-AC87-4396-84FE-8A399231CB3D"), item0.Content.Key); + Assert.AreEqual("Test1", item0.Content.ContentType.Alias); var item1 = converted.Layout.ElementAt(1); - Assert.AreEqual(Guid.Parse("0A4A416E-547D-464F-ABCC-6F345C17809A"), item1.Data.Key); - Assert.AreEqual("Test2", item1.Data.ContentType.Alias); + Assert.AreEqual(Guid.Parse("0A4A416E-547D-464F-ABCC-6F345C17809A"), item1.Content.Key); + Assert.AreEqual("Test2", item1.Content.ContentType.Alias); }