DX: Add BlockValue constructors to force correct property editor alias and layout item type (#16266)

* Improve getting and initializing new block value layouts

* Remove unnecessary generic type constraints

* Add and use new block value/layout item constructors in tests

* Removed GetLayouts that did not make sense

* Added constructor to BlockItemData to simplify explicit usages

---------

Co-authored-by: kjac <kja@umbraco.dk>
This commit is contained in:
Ronald Barendse
2024-05-14 13:34:54 +02:00
committed by GitHub
parent c7328bcbbc
commit cbf9781ae8
14 changed files with 281 additions and 286 deletions

View File

@@ -8,21 +8,10 @@ namespace Umbraco.Cms.Core.Models.Blocks;
/// </summary>
public class BlockEditorData<TValue, TLayout>
where TValue : BlockValue<TLayout>, new()
where TLayout : class, IBlockLayoutItem, new()
where TLayout : IBlockLayoutItem
{
private readonly string _propertyEditorAlias;
public BlockEditorData(
string propertyEditorAlias,
IEnumerable<ContentAndSettingsReference> references,
TValue blockValue)
public BlockEditorData(IEnumerable<ContentAndSettingsReference> references, TValue blockValue)
{
if (string.IsNullOrWhiteSpace(propertyEditorAlias))
{
throw new ArgumentException($"'{nameof(propertyEditorAlias)}' cannot be null or whitespace", nameof(propertyEditorAlias));
}
_propertyEditorAlias = propertyEditorAlias;
BlockValue = blockValue ?? throw new ArgumentNullException(nameof(blockValue));
References = references != null
? new List<ContentAndSettingsReference>(references)
@@ -30,17 +19,14 @@ public class BlockEditorData<TValue, TLayout>
}
private BlockEditorData()
{
_propertyEditorAlias = string.Empty;
BlockValue = new TValue();
}
=> BlockValue = new TValue();
public static BlockEditorData<TValue, TLayout> Empty { get; } = new();
/// <summary>
/// Returns the layout for this specific property editor
/// </summary>
public IEnumerable<TLayout>? Layout => BlockValue.GetLayouts(_propertyEditorAlias);
public IEnumerable<TLayout>? Layout => BlockValue.GetLayouts();
/// <summary>
/// Returns the reference to the original BlockValue

View File

@@ -13,7 +13,7 @@ namespace Umbraco.Cms.Core.Models.Blocks;
/// </summary>
public abstract class BlockEditorDataConverter<TValue, TLayout>
where TValue : BlockValue<TLayout>, new()
where TLayout : class, IBlockLayoutItem, new()
where TLayout : IBlockLayoutItem
{
private readonly IJsonSerializer _jsonSerializer;
@@ -42,7 +42,7 @@ public abstract class BlockEditorDataConverter<TValue, TLayout>
}
catch (Exception)
{
blockEditorData = null;
blockEditorData = default;
return false;
}
}
@@ -62,15 +62,13 @@ public abstract class BlockEditorDataConverter<TValue, TLayout>
public BlockEditorData<TValue, TLayout> Convert(TValue? value)
{
var propertyEditorAlias = new TValue().PropertyEditorAlias;
IEnumerable<TLayout>? layouts = value?.GetLayouts(propertyEditorAlias);
if (layouts is null)
if (value?.GetLayouts() is not IEnumerable<TLayout> layouts)
{
return BlockEditorData<TValue, TLayout>.Empty;
}
IEnumerable<ContentAndSettingsReference> references = GetBlockReferences(layouts);
return new BlockEditorData<TValue, TLayout>(propertyEditorAlias, references, value!);
return new BlockEditorData<TValue, TLayout>(references, value);
}
}

View File

@@ -1,8 +1,14 @@
namespace Umbraco.Cms.Core.Models.Blocks;
namespace Umbraco.Cms.Core.Models.Blocks;
public class BlockGridLayoutAreaItem
{
public Guid Key { get; set; } = Guid.Empty;
public BlockGridLayoutItem[] Items { get; set; } = Array.Empty<BlockGridLayoutItem>();
public BlockGridLayoutAreaItem()
{ }
public BlockGridLayoutAreaItem(Guid key)
=> Key = key;
}

View File

@@ -17,4 +17,14 @@ public class BlockGridLayoutItem : IBlockLayoutItem
public int? RowSpan { get; set; }
public BlockGridLayoutAreaItem[] Areas { get; set; } = Array.Empty<BlockGridLayoutAreaItem>();
public BlockGridLayoutItem()
{ }
public BlockGridLayoutItem(Udi contentUdi)
=> ContentUdi = contentUdi;
public BlockGridLayoutItem(Udi contentUdi, Udi settingsUdi)
: this(contentUdi)
=> SettingsUdi = settingsUdi;
}

View File

@@ -1,6 +1,23 @@
namespace Umbraco.Cms.Core.Models.Blocks;
namespace Umbraco.Cms.Core.Models.Blocks;
/// <summary>
/// Represents a block grid value.
/// </summary>
public class BlockGridValue : BlockValue<BlockGridLayoutItem>
{
/// <summary>
/// Initializes a new instance of the <see cref="BlockGridValue" /> class.
/// </summary>
public BlockGridValue()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="BlockGridValue" /> class.
/// </summary>
/// <param name="layouts">The layouts.</param>
public BlockGridValue(IEnumerable<BlockGridLayoutItem> layouts)
=> Layout[PropertyEditorAlias] = layouts;
/// <inheritdoc />
public override string PropertyEditorAlias => Constants.PropertyEditors.Aliases.BlockGrid;
}

View File

@@ -10,6 +10,17 @@ namespace Umbraco.Cms.Core.Models.Blocks;
/// </summary>
public class BlockItemData
{
public BlockItemData()
{
}
public BlockItemData(Udi udi, Guid contentTypeKey, string contentTypeAlias)
{
ContentTypeAlias = contentTypeAlias;
Udi = udi;
ContentTypeKey = contentTypeKey;
}
public Guid ContentTypeKey { get; set; }
/// <summary>

View File

@@ -11,4 +11,14 @@ public class BlockListLayoutItem : IBlockLayoutItem
public Udi? ContentUdi { get; set; }
public Udi? SettingsUdi { get; set; }
public BlockListLayoutItem()
{ }
public BlockListLayoutItem(Udi contentUdi)
=> ContentUdi = contentUdi;
public BlockListLayoutItem(Udi contentUdi, Udi settingsUdi)
: this(contentUdi)
=> SettingsUdi = settingsUdi;
}

View File

@@ -1,6 +1,23 @@
namespace Umbraco.Cms.Core.Models.Blocks;
namespace Umbraco.Cms.Core.Models.Blocks;
/// <summary>
/// Represents a block list value.
/// </summary>
public class BlockListValue : BlockValue<BlockListLayoutItem>
{
/// <summary>
/// Initializes a new instance of the <see cref="BlockListValue" /> class.
/// </summary>
public BlockListValue()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="BlockListValue" /> class.
/// </summary>
/// <param name="layouts">The layouts.</param>
public BlockListValue(IEnumerable<BlockListLayoutItem> layouts)
=> Layout[PropertyEditorAlias] = layouts;
/// <inheritdoc />
public override string PropertyEditorAlias => Constants.PropertyEditors.Aliases.BlockList;
}

View File

@@ -3,22 +3,56 @@
namespace Umbraco.Cms.Core.Models.Blocks;
/// <summary>
/// Represents a block value.
/// </summary>
public abstract class BlockValue
{
/// <summary>
/// Gets or sets the layout for specific property editors.
/// </summary>
/// <value>
/// The layout.
/// </value>
public IDictionary<string, IEnumerable<IBlockLayoutItem>> Layout { get; set; } = new Dictionary<string, IEnumerable<IBlockLayoutItem>>();
/// <summary>
/// Gets or sets the content data.
/// </summary>
/// <value>
/// The content data.
/// </value>
public List<BlockItemData> ContentData { get; set; } = [];
/// <summary>
/// Gets or sets the settings data.
/// </summary>
/// <value>
/// The settings data.
/// </value>
public List<BlockItemData> SettingsData { get; set; } = [];
/// <summary>
/// Gets the property editor alias of the current layout.
/// </summary>
/// <value>
/// The property editor alias of the current layout.
/// </value>
public abstract string PropertyEditorAlias { get; }
}
/// <inheritdoc />
public abstract class BlockValue<TLayout> : BlockValue
where TLayout : IBlockLayoutItem
{
public IEnumerable<TLayout>? GetLayouts(string propertyEditorAlias)
=> Layout.TryGetValue(propertyEditorAlias, out IEnumerable<IBlockLayoutItem>? layouts) is true
/// <summary>
/// Gets the layouts of the current property editor.
/// </summary>
/// <returns>
/// The layouts.
/// </returns>
public IEnumerable<TLayout>? GetLayouts()
=> Layout.TryGetValue(PropertyEditorAlias, out IEnumerable<IBlockLayoutItem>? layouts)
? layouts.OfType<TLayout>()
: null;
}
public abstract class BlockValue
{
public IDictionary<string, IEnumerable<IBlockLayoutItem>> Layout { get; set; } = new Dictionary<string, IEnumerable<IBlockLayoutItem>>();
public List<BlockItemData> ContentData { get; set; } = new();
public List<BlockItemData> SettingsData { get; set; } = new();
public abstract string PropertyEditorAlias { get; }
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) Umbraco.
// Copyright (c) Umbraco.
// See LICENSE for more details.
namespace Umbraco.Cms.Core.Models.Blocks;
@@ -11,4 +11,14 @@ public class RichTextBlockLayoutItem : IBlockLayoutItem
public Udi? ContentUdi { get; set; }
public Udi? SettingsUdi { get; set; }
public RichTextBlockLayoutItem()
{ }
public RichTextBlockLayoutItem(Udi contentUdi)
=> ContentUdi = contentUdi;
public RichTextBlockLayoutItem(Udi contentUdi, Udi settingsUdi)
: this(contentUdi)
=> SettingsUdi = settingsUdi;
}

View File

@@ -1,6 +1,23 @@
namespace Umbraco.Cms.Core.Models.Blocks;
/// <summary>
/// Represents a rich text block value.
/// </summary>
public class RichTextBlockValue : BlockValue<RichTextBlockLayoutItem>
{
/// <summary>
/// Initializes a new instance of the <see cref="RichTextBlockValue" /> class.
/// </summary>
public RichTextBlockValue()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="RichTextBlockValue" /> class.
/// </summary>
/// <param name="layouts">The layouts.</param>
public RichTextBlockValue(IEnumerable<RichTextBlockLayoutItem> layouts)
=> Layout[PropertyEditorAlias] = layouts;
/// <inheritdoc />
public override string PropertyEditorAlias => Constants.PropertyEditors.Aliases.TinyMce;
}

View File

@@ -254,7 +254,8 @@ public class RichTextPropertyEditor : DataEditor
handleMapping(blockEditorData.BlockValue);
return new RichTextEditorValue
{
Markup = richTextEditorValue.Markup, Blocks = blockEditorData.BlockValue
Markup = richTextEditorValue.Markup,
Blocks = blockEditorData.BlockValue,
};
}
@@ -263,7 +264,8 @@ public class RichTextPropertyEditor : DataEditor
RichTextEditorValue MarkupWithEmptyBlocks() => new()
{
Markup = richTextEditorValue.Markup, Blocks = new RichTextBlockValue()
Markup = richTextEditorValue.Markup,
Blocks = new RichTextBlockValue(),
};
}

View File

@@ -171,28 +171,15 @@ public class PropertyIndexValueFactoryTests : UmbracoIntegrationTest
var editor = dataType.Editor!;
var contentElementUdi = new GuidUdi(Constants.UdiEntityType.Element, Guid.NewGuid());
var blockListValue = new BlockListValue
var blockListValue = new BlockListValue(
[
new BlockListLayoutItem(contentElementUdi)
])
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>
{
{
Constants.PropertyEditors.Aliases.BlockList,
new IBlockLayoutItem[]
{
new BlockListLayoutItem()
{
ContentUdi = contentElementUdi
}
}
}
},
ContentData =
[
new()
new(contentElementUdi, elementType.Key, elementType.Alias)
{
Udi = contentElementUdi,
ContentTypeAlias = elementType.Alias,
ContentTypeKey = elementType.Key,
RawPropertyValues = new Dictionary<string, object?>
{
{"singleLineText", "The single line of text in the block"},
@@ -287,65 +274,48 @@ public class PropertyIndexValueFactoryTests : UmbracoIntegrationTest
var contentElementUdi = new GuidUdi(Constants.UdiEntityType.Element, Guid.NewGuid());
var contentAreaElementUdi = new GuidUdi(Constants.UdiEntityType.Element, Guid.NewGuid());
var blockGridValue = new BlockGridValue
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>
var blockGridValue = new BlockGridValue(
[
new BlockGridLayoutItem(contentElementUdi)
{
{
Constants.PropertyEditors.Aliases.BlockGrid,
new IBlockLayoutItem[]
ColumnSpan = 12,
RowSpan = 1,
Areas =
[
new BlockGridLayoutAreaItem(Guid.NewGuid())
{
new BlockGridLayoutItem
{
ColumnSpan = 12,
RowSpan = 1,
ContentUdi = contentElementUdi,
Areas = new []
Items =
[
new BlockGridLayoutItem(contentAreaElementUdi)
{
new BlockGridLayoutAreaItem
{
Key = Guid.NewGuid(),
Items = new []
{
new BlockGridLayoutItem
{
ContentUdi = contentAreaElementUdi,
ColumnSpan = 12,
RowSpan = 1
}
}
}
}
}
}
}
ColumnSpan = 12,
RowSpan = 1,
},
],
},
],
},
])
{
ContentData =
[
new()
new(contentElementUdi, elementType.Key, elementType.Alias)
{
Udi = contentElementUdi,
ContentTypeAlias = elementType.Alias,
ContentTypeKey = elementType.Key,
RawPropertyValues = new Dictionary<string, object?>
RawPropertyValues = new()
{
{"singleLineText", "The single line of text in the grid root"},
{"bodyText", "<p>The body text in the grid root</p>"}
}
{ "singleLineText", "The single line of text in the grid root" },
{ "bodyText", "<p>The body text in the grid root</p>" },
},
},
new()
new(contentAreaElementUdi, elementType.Key, elementType.Alias)
{
Udi = contentAreaElementUdi,
ContentTypeAlias = elementType.Alias,
ContentTypeKey = elementType.Key,
RawPropertyValues = new Dictionary<string, object?>
RawPropertyValues = new()
{
{"singleLineText", "The single line of text in the grid area"},
{"bodyText", "<p>The body text in the grid area</p>"}
}
}
{ "singleLineText", "The single line of text in the grid area" },
{ "bodyText", "<p>The body text in the grid area</p>" },
},
},
],
SettingsData = []
};
var propertyValue = JsonSerializer.Serialize(blockGridValue);

View File

@@ -1,4 +1,4 @@
using NUnit.Framework;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Infrastructure.Serialization;
@@ -25,78 +25,61 @@ public class JsonBlockValueConverterTests
var elementType3Key = Guid.NewGuid();
var elementType4Key = Guid.NewGuid();
var blockGridValue = new BlockGridValue
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>
var blockGridValue = new BlockGridValue(
[
new BlockGridLayoutItem(contentElementUdi1, settingsElementUdi1)
{
{
Constants.PropertyEditors.Aliases.BlockGrid,
new IBlockLayoutItem[]
ColumnSpan = 123,
RowSpan = 456,
Areas =
[
new BlockGridLayoutAreaItem(Guid.NewGuid())
{
new BlockGridLayoutItem
{
ColumnSpan = 123,
RowSpan = 456,
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1,
Areas = new []
Items =
[
new BlockGridLayoutItem(contentElementUdi3, settingsElementUdi3)
{
new BlockGridLayoutAreaItem
{
Key = Guid.NewGuid(),
Items = new []
ColumnSpan = 12,
RowSpan = 34,
Areas =
[
new BlockGridLayoutAreaItem(Guid.NewGuid())
{
new BlockGridLayoutItem
{
ColumnSpan = 12,
RowSpan = 34,
ContentUdi = contentElementUdi3,
SettingsUdi = settingsElementUdi3,
Areas = new []
Items =
[
new BlockGridLayoutItem(contentElementUdi4, settingsElementUdi4)
{
new BlockGridLayoutAreaItem
{
Key = Guid.NewGuid(),
Items = new []
{
new BlockGridLayoutItem
{
ColumnSpan = 56,
RowSpan = 78,
ContentUdi = contentElementUdi4,
SettingsUdi = settingsElementUdi4
}
}
}
}
}
}
}
}
},
new BlockGridLayoutItem
{
ColumnSpan = 789,
RowSpan = 123,
ContentUdi = contentElementUdi2,
SettingsUdi = settingsElementUdi2
}
}
}
ColumnSpan = 56,
RowSpan = 78,
},
],
},
],
},
],
},
],
},
new BlockGridLayoutItem(contentElementUdi2, settingsElementUdi2)
{
ColumnSpan = 789,
RowSpan = 123,
}
])
{
ContentData =
[
new() { Udi = contentElementUdi1, ContentTypeAlias = "elementType1", ContentTypeKey = elementType1Key },
new() { Udi = contentElementUdi2, ContentTypeAlias = "elementType2", ContentTypeKey = elementType2Key },
new() { Udi = contentElementUdi3, ContentTypeAlias = "elementType3", ContentTypeKey = elementType3Key },
new() { Udi = contentElementUdi4, ContentTypeAlias = "elementType¤", ContentTypeKey = elementType4Key },
new(contentElementUdi1, elementType1Key, "elementType1"),
new(contentElementUdi2, elementType2Key, "elementType2"),
new(contentElementUdi3, elementType3Key, "elementType3"),
new(contentElementUdi4, elementType4Key, "elementType4"),
],
SettingsData =
[
new() { Udi = settingsElementUdi1, ContentTypeAlias = "elementType3", ContentTypeKey = elementType3Key },
new() { Udi = settingsElementUdi2, ContentTypeAlias = "elementType4", ContentTypeKey = elementType4Key },
new() { Udi = settingsElementUdi3, ContentTypeAlias = "elementType1", ContentTypeKey = elementType1Key },
new() { Udi = settingsElementUdi4, ContentTypeAlias = "elementType2", ContentTypeKey = elementType2Key }
new(settingsElementUdi1, elementType3Key, "elementType3"),
new(settingsElementUdi2, elementType4Key, "elementType4"),
new(settingsElementUdi3, elementType1Key, "elementType1"),
new(settingsElementUdi4, elementType2Key, "elementType2")
]
};
@@ -189,13 +172,7 @@ public class JsonBlockValueConverterTests
[Test]
public void Can_Serialize_BlockGrid_Without_Blocks()
{
var blockGridValue = new BlockGridValue
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>(),
ContentData = [],
SettingsData = []
};
var blockGridValue = new BlockGridValue();
var serializer = new SystemTextJsonSerializer();
var serialized = serializer.Serialize(blockGridValue);
var deserialized = serializer.Deserialize<BlockGridValue>(serialized);
@@ -222,36 +199,21 @@ public class JsonBlockValueConverterTests
var elementType3Key = Guid.NewGuid();
var elementType4Key = Guid.NewGuid();
var blockListValue = new BlockListValue
var blockListValue = new BlockListValue(
[
new BlockListLayoutItem(contentElementUdi1, settingsElementUdi1),
new BlockListLayoutItem(contentElementUdi2, settingsElementUdi2),
])
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>
{
{
Constants.PropertyEditors.Aliases.BlockList,
new IBlockLayoutItem[]
{
new BlockListLayoutItem()
{
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1
},
new BlockListLayoutItem
{
ContentUdi = contentElementUdi2,
SettingsUdi = settingsElementUdi2
}
}
}
},
ContentData =
[
new() { Udi = contentElementUdi1, ContentTypeAlias = "elementType1", ContentTypeKey = elementType1Key },
new() { Udi = contentElementUdi2, ContentTypeAlias = "elementType2", ContentTypeKey = elementType2Key }
new(contentElementUdi1, elementType1Key, "elementType1"),
new(contentElementUdi2, elementType2Key, "elementType2")
],
SettingsData =
[
new() { Udi = settingsElementUdi1, ContentTypeAlias = "elementType3", ContentTypeKey = elementType3Key },
new() { Udi = settingsElementUdi2, ContentTypeAlias = "elementType4", ContentTypeKey = elementType4Key }
new(settingsElementUdi1, elementType3Key, "elementType3"),
new(settingsElementUdi2, elementType4Key, "elementType4")
]
};
@@ -302,13 +264,7 @@ public class JsonBlockValueConverterTests
[Test]
public void Can_Serialize_BlockList_Without_Blocks()
{
var blockListValue = new BlockListValue
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>(),
ContentData = [],
SettingsData = []
};
var blockListValue = new BlockListValue();
var serializer = new SystemTextJsonSerializer();
var serialized = serializer.Serialize(blockListValue);
var deserialized = serializer.Deserialize<BlockListValue>(serialized);
@@ -335,36 +291,21 @@ public class JsonBlockValueConverterTests
var elementType3Key = Guid.NewGuid();
var elementType4Key = Guid.NewGuid();
var richTextBlockValue = new RichTextBlockValue
var richTextBlockValue = new RichTextBlockValue(
[
new RichTextBlockLayoutItem(contentElementUdi1, settingsElementUdi1),
new RichTextBlockLayoutItem(contentElementUdi2, settingsElementUdi2),
])
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>
{
{
Constants.PropertyEditors.Aliases.TinyMce,
new IBlockLayoutItem[]
{
new RichTextBlockLayoutItem
{
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1
},
new RichTextBlockLayoutItem
{
ContentUdi = contentElementUdi2,
SettingsUdi = settingsElementUdi2
}
}
}
},
ContentData =
[
new() { Udi = contentElementUdi1, ContentTypeAlias = "elementType1", ContentTypeKey = elementType1Key },
new() { Udi = contentElementUdi2, ContentTypeAlias = "elementType2", ContentTypeKey = elementType2Key }
new(contentElementUdi1, elementType1Key, "elementType1"),
new(contentElementUdi2, elementType2Key, "elementType2")
],
SettingsData =
[
new() { Udi = settingsElementUdi1, ContentTypeAlias = "elementType3", ContentTypeKey = elementType3Key },
new() { Udi = settingsElementUdi2, ContentTypeAlias = "elementType4", ContentTypeKey = elementType4Key }
new(settingsElementUdi1, elementType3Key, "elementType3"),
new(settingsElementUdi2, elementType4Key, "elementType4")
]
};
@@ -426,12 +367,7 @@ public class JsonBlockValueConverterTests
{
var richTextEditorValue = new RichTextEditorValue
{
Blocks = new RichTextBlockValue
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>(),
ContentData = new List<BlockItemData>(),
SettingsData = new List<BlockItemData>()
},
Blocks = new RichTextBlockValue(),
Markup = "<p>This is some markup</p>"
};
@@ -459,62 +395,33 @@ public class JsonBlockValueConverterTests
var elementType1Key = Guid.NewGuid();
var elementType2Key = Guid.NewGuid();
var blockListValue = new BlockListValue
var blockListValue = new BlockListValue(
[
new BlockListLayoutItem(contentElementUdi1, settingsElementUdi1),
])
{
Layout = new Dictionary<string, IEnumerable<IBlockLayoutItem>>
Layout =
{
{
Constants.PropertyEditors.Aliases.TinyMce,
new IBlockLayoutItem[]
{
new RichTextBlockLayoutItem
{
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1
}
}
},
{
Constants.PropertyEditors.Aliases.BlockList,
new IBlockLayoutItem[]
{
new BlockListLayoutItem
{
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1
}
}
},
{
Constants.PropertyEditors.Aliases.BlockGrid,
new IBlockLayoutItem[]
{
new BlockGridLayoutItem
{
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1
}
}
},
{
"Some.Custom.Block.Editor",
new IBlockLayoutItem[]
{
new BlockListLayoutItem
{
ContentUdi = contentElementUdi1,
SettingsUdi = settingsElementUdi1
}
}
}
[Constants.PropertyEditors.Aliases.TinyMce] =
[
new RichTextBlockLayoutItem(contentElementUdi1, settingsElementUdi1)
],
[Constants.PropertyEditors.Aliases.BlockGrid] =
[
new BlockGridLayoutItem(contentElementUdi1, settingsElementUdi1),
],
["Some.Custom.Block.Editor"] =
[
new BlockListLayoutItem(contentElementUdi1, settingsElementUdi1),
]
},
ContentData =
[
new() { Udi = contentElementUdi1, ContentTypeAlias = "elementType1", ContentTypeKey = elementType1Key },
new(contentElementUdi1, elementType1Key, "elementType1"),
],
SettingsData =
[
new() { Udi = settingsElementUdi1, ContentTypeAlias = "elementType2", ContentTypeKey = elementType2Key },
new(settingsElementUdi1, elementType2Key, "elementType2")
]
};