A grid editor value converter is a class that will convert the input value from an Umbraco grid editor into an IEnterspeedProperty.To implement your own converter you need to implement the IEnterspeedGridEditorValueConverter interfaceIf no converter is registered for the grid editor, the DefaultGridLayoutPropertyValueConverter will tryto convert it into an IEnterspeedProprety automatically, by looking at the types.
This method is called when the EnterspeedGridEditorService tries to find the correct converter for this grid editor.An implementation of this method could look like this:
public bool IsConverter(string alias){ return alias.InvariantEquals("rte");}
Converters are registered in Umbraco via an IComposer.Umbraco 9+
public class MyCustomerGridEditorValueConverterComposer : IComposer{ public void Compose(IUmbracoBuilder builder) { builder.EnterspeedGridEditorValueConverters() .Append<MyCustomGridEditorValueConverter>(); }}
Umbraco 8
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]public class MyCustomerGridEditorValueConverterComposer : IUserComposer{ composition.EnterspeedGridEditorValueConverters() .Append<MyCustomGridEditorValueConverter>();}
Note that the EnterspeedGridEditorService will find the converters in the order that they are registered, which means that, if you want to replace a default converter with your own, you need to insert your converter like this:Umbraco 9+
public class MyCustomerPropertyValueConverterComposer : IComposer{ public void Compose(IUmbracoBuilder builder) { builder.EnterspeedGridEditorValueConverters() .InsertBefore<DefaultRichTextEditorGridEditorValueConverter, MyCustomGridEditorValueConverter>(); }}
Umbraco 8
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]public class MyCustomerPropertyValueConverterComposer : IUserComposer{ composition.EnterspeedGridEditorValueConverters() .InsertBefore<DefaultRichTextEditorGridEditorValueConverter, MyCustomGridEditorValueConverter>();}