Skalman
03/03/2025, 8:04 PMpublic class PromotedMigrator : GridBlockMigratorSimpleBase, ISyncBlockMigrator
{
public PromotedMigrator(IShortStringHelper shortStringHelper)
: base(shortStringHelper) { }
public string[] Aliases => new[] { "promoted" };
public override string GetEditorAlias(ILegacyGridEditorConfig editor) => "Promoted";
public IEnumerable<NewContentTypeInfo> AdditionalContentTypes(ILegacyGridEditorConfig editor)
{
var alias = this.GetContentTypeAlias(editor);
return new NewContentTypeInfo(
alias.ToGuid(),
alias,
editor.Name ?? editor.Alias!,
$"{editor.Icon ?? "icon-book"} color-purple",
"BlockGrid/Elements")
{
Description = $"Converted from Grid {editor.Name} element using custom migrator ",
IsElement = true,
Properties = new List<NewContentTypeProperty>
{
new NewContentTypeProperty(
alias: "title",
name: "Title",
dataTypeAlias: "Umbraco.TextBox"
)
}
}.AsEnumerableOfOne();
}
public Dictionary<string, object> GetPropertyValues(GridValue.GridControl control, SyncMigrationContext context)
{
var val = new Dictionary<string, object>();
var data = control.Value; // this is the JSON input value from the U8 grid
var title = data?.Value<string>("title");
val.Add("title", title);
return val;
}
}
bielu
03/06/2025, 7:26 PM