Is it possible to override/replace TextStringValueConverter?
Hi all,
I need to change how local links are parsed in rte fields and a good fix would be if I could alter a bit TextStringValueConverter. This way I can fix everything in one place.
Not sure how converters work, but it looks like they are hooked via attributes, like
[PropertyValueType(typeof(string))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Request)]
public class TextStringValueConverter : PropertyValueConverterBase{..}
If I make my own, how can I plug it in to replace the standard one?
Or is that even possible?
[Update] - actually I may have been a little wrong and need to change another converter (the one for rte values) not TextStringValueConverter. But still is this possible?
I ended up making two conververs one for Text and one for Rte. Then I had to remove the standard umbraco converters in AppStarting event like this:
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
// remove standard umbraco converters, because we have made custom ones in order to fix the anchor links
PropertyValueConvertersResolver.Current.RemoveType<Umbraco.Web.PropertyEditors.ValueConverters.TextStringValueConverter>();
PropertyValueConvertersResolver.Current.RemoveType<Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter>();
}
otherwise I would get duplicate converters conflict.
Looks like it's working.
Is it possible to override/replace TextStringValueConverter?
Hi all,
I need to change how local links are parsed in rte fields and a good fix would be if I could alter a bit TextStringValueConverter. This way I can fix everything in one place.
Not sure how converters work, but it looks like they are hooked via attributes, like [PropertyValueType(typeof(string))] [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Request)] public class TextStringValueConverter : PropertyValueConverterBase{..}
If I make my own, how can I plug it in to replace the standard one? Or is that even possible?
[Update] - actually I may have been a little wrong and need to change another converter (the one for rte values) not TextStringValueConverter. But still is this possible?
I ended up making two conververs one for Text and one for Rte. Then I had to remove the standard umbraco converters in AppStarting event like this:
otherwise I would get duplicate converters conflict. Looks like it's working.
is working on a reply...