Class EntityDataPickerValueConverter
Converts the value stored by an entity data picker property editor into a strongly-typed object that can be used within Umbraco, such as an entity identifier or reference.
Namespace: Umbraco.Cms.Core.PropertyEditors.ValueConverters
Assembly: Umbraco.Infrastructure.dll
Syntax
[DefaultPropertyValueConverter(new Type[] { typeof(JsonValueConverter) })]
public sealed class EntityDataPickerValueConverter : PropertyValueConverterBase, IPropertyValueConverter, IDiscoverable
Remarks
NOTE: this class is made public on purpose because all value converters should be public
Constructors
View SourceEntityDataPickerValueConverter(IJsonSerializer)
Initializes a new instance of the EntityDataPickerValueConverter class.
Declaration
public EntityDataPickerValueConverter(IJsonSerializer jsonSerializer)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonSerializer | jsonSerializer | The JSON serializer used to deserialize property values. |
Methods
View SourceConvertSourceToIntermediate(IPublishedElement, IPublishedPropertyType, object?, bool)
Converts the source value for an entity data picker property to an intermediate EntityDataPickerValue object.
Declaration
public override object? ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object? source, bool preview)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedElement | owner | The IPublishedElement that owns the property. |
| IPublishedPropertyType | propertyType | The IPublishedPropertyType metadata for the property. |
| object | source | The source value to convert, expected to be a JSON string representing entity data picker values. |
| bool | preview | A value indicating whether the conversion is for preview mode. |
Returns
| Type | Description |
|---|---|
| object | An EntityDataPickerValue object representing the intermediate value, or |
GetPropertyCacheLevel(IPublishedPropertyType)
Gets the property cache level.
Declaration
public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedPropertyType | propertyType | The property type. |
Returns
| Type | Description |
|---|---|
| PropertyCacheLevel | The property cache level. |
GetPropertyValueType(IPublishedPropertyType)
Returns the CLR type used to represent the value of the specified published property type when using the Entity Data Picker value converter.
Declaration
public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedPropertyType | propertyType | The published property type for which to retrieve the value type. |
Returns
| Type | Description |
|---|---|
| Type | The System.Type representing EntityDataPickerValue. |
IsConverter(IPublishedPropertyType)
Determines whether this value converter is applicable to the specified property type based on its editor alias.
Declaration
public override bool IsConverter(IPublishedPropertyType propertyType)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedPropertyType | propertyType | The published property type to evaluate. |
Returns
| Type | Description |
|---|---|
| bool |
|