WIP
This commit is contained in:
@@ -10,32 +10,42 @@ namespace Umbraco.Core.Models.Blocks
|
||||
[DataContract(Name = "blockListLayout", Namespace = "")]
|
||||
public class BlockListLayoutReference : IBlockElement<IPublishedElement>
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Id of the data item
|
||||
/// The Id of the content data item
|
||||
/// </summary>
|
||||
[DataMember(Name = "udi")]
|
||||
public Udi Udi { get; }
|
||||
[DataMember(Name = "contentUdi")]
|
||||
public Udi ContentUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The settings for the layout item
|
||||
/// The Id of the settings data item
|
||||
/// </summary>
|
||||
[DataMember(Name = "settings")]
|
||||
public IPublishedElement Settings { get; }
|
||||
[DataMember(Name = "settingsUdi")]
|
||||
public Udi SettingsUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The data item referenced
|
||||
/// The content data item referenced
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is ignored from serialization since it is just a reference to the actual data element
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
public IPublishedElement Data { get; }
|
||||
public IPublishedElement Content { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The settings data item referenced
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is ignored from serialization since it is just a reference to the actual data element
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
public IPublishedElement Settings { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
/// </remarks>
|
||||
public interface IBlockReference
|
||||
{
|
||||
Udi Udi { get; }
|
||||
Udi ContentUdi { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user