Skip to content

Adding your custom editor model in Nikcio.UHeadless

Nikcio.UHeadless provides flexibility to add your models for custom property editors. This documentation outlines one example of how you can create this model.

Example 1

  1. Create your custom editor model:
using Nikcio.UHeadless.Base.Properties.Commands;
using Nikcio.UHeadless.Base.Properties.Models;
public class MyPropertyValue : PropertyValue
{
public string? Name { get; set; }
public MyPropertyValue(CreatePropertyValue createPropertyValue) : base(createPropertyValue)
{
var value = createPropertyValue.Property.GetValue(createPropertyValue.Culture);
if (value == null)
{
return;
}
Name = (string) value;
}
}
  1. Register the model in the UHeadless options:
.AddUHeadless(new()
{
PropertyServicesOptions = new()
{
PropertyMapOptions = new()
{
PropertyMappings = new()
{
map => map.AddEditorMapping<MyPropertyValue>("customEditor")
}
}
}
})
Method NameDescription
AddAliasMappingAdds a mapping of a type to a content type alias and property type alias.
AddEditorMappingAdds a mapping of a type to an editor alias.

Make sure to replace the appropriate namespaces and class names with your custom implementations.