Nullable Property Value Converters for value types in Umbraco.
If an editor hasn't set a value for a "value type" property, then these converters will return null instead of a default value. This makes editor intent clearer - you can tell the difference between an integer that an edtor intentionally chose to be "0" as opposed to an integer property that's been left empty.
Return null if an editor has not entered a value.
Though they don't have a null state in the UI, they can be empty if:
In these cases the following converters might be helpful...
Enabled by default. This converter returns the "Initial State" (default) value that has been configured in the property editor's settings.
Disabled by default.
You can configure Emptiness with appsettings.json like this:
"Emptiness": {
"EnabledConverters": [
"NullableDatePickerConverter",
"NullableDecimalConverter",
"NullableIntegerConverter"
],
"TrueFalseConverter": "Nullable"
}
This is the default configuration.
EnabledConverters
If provided, enables only the PVCs listed.
Property Value Converter names:
NullableDatePickerConverter
NullableDecimalConverter
NullableIntegerConverter
NullableLabelConverter
TrueFalseConverter
Determines the True/False (Yes/No) conveter to use for booleans.
Options:
Core
- use Umbraco's built in converter.DefaultValue
- use the YesNoDefaultConverterNullable
- use the NullableYesNoConverterCopyright © 2022 Jason Elkin
Licensed under the MIT License.