Value Converter
Was this page helpful?
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
bool IsConverter(IPublishedPropertyType propertyType);
public bool IsConverter(IPublishedPropertyType propertyType)
{
return propertyType.EditorAlias.Equals("Umbraco.TextBox");
}
IEnterspeedProperty Convert(IPublishedProperty property, string culture);
public IEnterspeedProperty Convert(IPublishedProperty property, string culture)
{
var value = property.GetValue<string>(culture);
return new StringEnterspeedProperty(property.Alias, value);
}
public class MyCustomerPropertyValueConverterComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.EnterspeedPropertyValueConverters()
.Append<MyCustomPropertyValueConverter>();
}
}
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class MyCustomerPropertyValueConverterComposer : IUserComposer
{
composition.EnterspeedPropertyValueConverters()
.Append<MyCustomPropertyValueConverter>();
}
public class RegisterCustomPropertyValueConverters : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
EnterspeedContext.Current.EnterspeedPropertyValueConverters
.Append<MyEmbeddedContentPropertyValueConverter>();
}
}
[ComposeAfter(typeof(EnterspeedComposer))]
public class MyCustomerPropertyValueConverterComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.EnterspeedPropertyValueConverters()
.InsertBefore<DefaultTextboxPropertyValueConverter,MyCustomPropertyValueConverter>();
}
}
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class MyCustomerPropertyValueConverterComposer : IUserComposer
{
composition.EnterspeedPropertyValueConverters()
.InsertBefore<DefaultTextboxPropertyValueConverter,MyCustomPropertyValueConverter>();
}
public class RegisterCustomPropertyValueConverters : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
EnterspeedContext.Current.EnterspeedPropertyValueConverters
.InsertBefore<DefaultTextboxPropertyValueConverter, MyCustomTextboxPropertyValueConverter>();
}
}
Was this page helpful?