Class BlockEditorPropertyValueEditor<TValue, TLayout>
Provides an abstract base class for property value editors based on block editors.
Namespace: Umbraco.Cms.Core.PropertyEditors
Assembly: Umbraco.Infrastructure.dll
Syntax
public abstract class BlockEditorPropertyValueEditor<TValue, TLayout> : BlockValuePropertyValueEditorBase<TValue, TLayout>, IDataValueEditor, IDataValueReference, IDataValueTags where TValue : BlockValue<TLayout>, new() where TLayout : class, IBlockLayoutItem, new()
Type Parameters
| Name | Description |
|---|---|
| TValue | |
| TLayout |
Constructors
View SourceBlockEditorPropertyValueEditor(PropertyEditorCollection, DataValueReferenceFactoryCollection, IDataTypeConfigurationCache, IShortStringHelper, IJsonSerializer, BlockEditorVarianceHandler, ILanguageService, IIOHelper, DataEditorAttribute, ILogger)
Initializes a new instance of the BlockEditorPropertyValueEditor<TValue, TLayout> class.
Declaration
protected BlockEditorPropertyValueEditor(PropertyEditorCollection propertyEditors, DataValueReferenceFactoryCollection dataValueReferenceFactories, IDataTypeConfigurationCache dataTypeConfigurationCache, IShortStringHelper shortStringHelper, IJsonSerializer jsonSerializer, BlockEditorVarianceHandler blockEditorVarianceHandler, ILanguageService languageService, IIOHelper ioHelper, DataEditorAttribute attribute, ILogger logger)
Parameters
| Type | Name | Description |
|---|---|---|
| PropertyEditorCollection | propertyEditors | |
| DataValueReferenceFactoryCollection | dataValueReferenceFactories | |
| IDataTypeConfigurationCache | dataTypeConfigurationCache | |
| IShortStringHelper | shortStringHelper | |
| IJsonSerializer | jsonSerializer | |
| BlockEditorVarianceHandler | blockEditorVarianceHandler | |
| ILanguageService | languageService | |
| IIOHelper | ioHelper | |
| DataEditorAttribute | attribute | |
| ILogger | logger |
Properties
View SourceJsonSerializer
Gets the IJsonSerializer.
Declaration
protected IJsonSerializer JsonSerializer { get; }
Property Value
| Type | Description |
|---|---|
| IJsonSerializer |
Methods
View SourceFromEditor(ContentPropertyData, object?)
A method to deserialize the string value that has been saved in the content editor to an object to be stored in the database.
Declaration
public override object? FromEditor(ContentPropertyData editorValue, object? currentValue)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentPropertyData | editorValue | The value returned by the editor. |
| object | currentValue | The current value that has been persisted to the database for this editor. This value may be useful for how the value then get's deserialized again to be re-persisted. In most cases it will probably not be used. |
Returns
| Type | Description |
|---|---|
| object | The value that gets persisted to the database. |
Remarks
By default this will attempt to automatically convert the string value to the value type supplied by ValueType. If overridden then the object returned must match the type supplied in the ValueType, otherwise persisting the value to the DB will fail when it tries to validate the value type.
GetReferences(object?)
Returns any references contained in the value
Declaration
public override IEnumerable<UmbracoEntityReference> GetReferences(object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value |
Returns
| Type | Description |
|---|---|
| IEnumerable<UmbracoEntityReference> |
GetTags(object?, object?, int?)
Returns any tags contained in the value
Declaration
public override IEnumerable<ITag> GetTags(object? value, object? dataTypeConfiguration, int? languageId)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | |
| object | dataTypeConfiguration | |
| int? | languageId |
Returns
| Type | Description |
|---|---|
| IEnumerable<ITag> |
ToEditor(IProperty, string?, string?)
A method used to format the database value to a value that can be used by the editor.
Declaration
public override object ToEditor(IProperty property, string? culture = null, string? segment = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | The property. |
| string | culture | The culture. |
| string | segment | The segment. |
Returns
| Type | Description |
|---|---|
| object |
Remarks
The object returned will automatically be serialized into JSON notation. For most property editors the value returned is probably just a string, but in some cases a JSON structure will be returned.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | ValueType was out of range. |