ProNotion
06/21/2024, 11:33 AMGridRTEBlockMigrator
from the package with my own. I've added a composer to try and replace it but that doesn't seem to do the trick:
[ComposeAfter(typeof(BlockGridMigratorComposer))]
public class MigrationComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
// Replace the original RTE Block Migrator with our own
builder.SyncBlockMigrators().Exclude<GridRTEBlockMigrator>().Add<MyGridRTEBlockMigrator>();
}
}
Any ideas?Mike Chambers
06/21/2024, 11:45 AMMike Chambers
06/21/2024, 11:46 AMbuilder.SyncPropertyMigrators().Replace<GridMigrator, DTGEMigrator.DTGEMigrator>();
ProNotion
06/21/2024, 11:47 AMSyncPropertyMigrators
this is not one of those it inherits from ISyncBlockMigrator
Mike Chambers
06/21/2024, 11:48 AMMike Chambers
06/21/2024, 11:48 AMProNotion
06/21/2024, 11:49 AMMike Chambers
06/21/2024, 11:52 AMMike Chambers
06/21/2024, 11:53 AMProNotion
06/21/2024, 11:54 AMMike Chambers
06/21/2024, 11:56 AMbuilder .WithCollectionBuilder<SyncBlockMigratorCollectionBuilder>()
.Exclude()
seems to be a thing?Mike Chambers
06/21/2024, 11:57 AMMike Chambers
06/21/2024, 11:58 AMProNotion
06/21/2024, 12:07 PMProNotion
06/21/2024, 12:21 PMGridToBlockGridMigrator
and on breaking into the contructor I can view the SyncBlockMigratorCollection
passed into it and sure enough MyGridRTEBlockMigrator
is present and the default one isn't which is the result I was hoping for.
Thanks @Mike Chambers for your input.Mike Chambers
06/21/2024, 12:22 PMProNotion
06/21/2024, 12:24 PMSyncBlockMigratorCollectionBuilder
inherits from LazyCollectionBuilderBase<SyncBlockMigratorCollectionBuilder
ProNotion
06/21/2024, 12:30 PMProNotion
06/21/2024, 1:37 PMpublic class MyGridRTEBlockMigrator : GridBlockMigratorSimpleBase, ISyncBlockMigrator
{
public MyGridRTEBlockMigrator (IShortStringHelper shortStringHelper)
: base(shortStringHelper) { }
public string[] Aliases => new[] { "rte" };
public override string GetEditorAlias(ILegacyGridEditorConfig editor) => "Richtext Editor";
public override string GetContentTypeAlias(LegacyGridValue.LegacyGridControl control) =>
RichTextContentBlock.ModelTypeAlias;
public override Dictionary<string, object> GetPropertyValues(LegacyGridValue.LegacyGridControl control, SyncMigrationContext context)
{
var rtePropertyTypeAlias = ModelHelpers.GetElementPropertyTypeAlias<RichTextContentBlock>(m => m.BodyText);
return new Dictionary<string, object>
{
{ rtePropertyTypeAlias, control.Value ?? string.Empty }
};
}
}
TECKSPEED
06/21/2024, 1:51 PMGridRTEBlockMigrator
and then you can turn it into your custom typeTECKSPEED
06/21/2024, 1:54 PMProNotion
06/21/2024, 2:50 PMTECKSPEED
06/21/2024, 3:13 PM