Class DataEditor
Represents a data editor.
Inheritance
Namespace: Umbraco.Core.PropertyEditors
Assembly: Umbraco.Core.dll
Syntax
public class DataEditor : IDataEditor, IDiscoverable
Remarks
Editors can be deserialized from e.g. manifests, which is. why the class is not abstract, the json serialization attributes are required, and the properties have an internal setter.
Constructors
View SourceDataEditor(ILogger, EditorType)
Initializes a new instance of the DataEditor class.
Declaration
public DataEditor(ILogger logger, EditorType type = EditorType.PropertyValue)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | |
EditorType | type |
Properties
View SourceAlias
Gets the alias of the editor.
Declaration
public string Alias { get; }
Property Value
Type | Description |
---|---|
System.String |
Attribute
Gets the editor attribute.
Declaration
protected DataEditorAttribute Attribute { get; }
Property Value
Type | Description |
---|---|
DataEditorAttribute |
DefaultConfiguration
Gets the configuration for the value editor.
Declaration
public IDictionary<string, object> DefaultConfiguration { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |
ExplicitConfigurationEditor
Gets or sets an explicit configuration editor.
Declaration
public IConfigurationEditor ExplicitConfigurationEditor { get; set; }
Property Value
Type | Description |
---|---|
IConfigurationEditor |
Remarks
Used for manifest data editors.
ExplicitValueEditor
Gets or sets an explicit value editor.
Declaration
public IDataValueEditor ExplicitValueEditor { get; set; }
Property Value
Type | Description |
---|---|
IDataValueEditor |
Remarks
Used for manifest data editors.
Group
Gets the group of the editor.
Declaration
public string Group { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Can be used to organize editors when presenting them.
Icon
Gets the icon of the editor.
Declaration
public string Icon { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Can be used to display editors when presenting them.
IsDeprecated
Gets a value indicating whether the editor is deprecated.
Declaration
public bool IsDeprecated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Deprecated editors are supported but not proposed in the UI.
Logger
Gets a logger.
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
ILogger |
Name
Gets the name of the editor.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
PropertyIndexValueFactory
Gets the index value factory for the editor.
Declaration
public virtual IPropertyIndexValueFactory PropertyIndexValueFactory { get; }
Property Value
Type | Description |
---|---|
IPropertyIndexValueFactory |
Type
Gets the type of the editor.
Declaration
public EditorType Type { get; }
Property Value
Type | Description |
---|---|
EditorType |
Remarks
An editor can be a property value editor, or a parameter editor.
Methods
View SourceCreateConfigurationEditor()
Creates a configuration editor instance.
Declaration
protected virtual IConfigurationEditor CreateConfigurationEditor()
Returns
Type | Description |
---|---|
IConfigurationEditor |
CreateValueEditor()
Creates a value editor instance.
Declaration
protected virtual IDataValueEditor CreateValueEditor()
Returns
Type | Description |
---|---|
IDataValueEditor |
DebuggerDisplay()
Provides a summary of the PropertyEditor for use with the System.Diagnostics.DebuggerDisplayAttribute.
Declaration
protected virtual string DebuggerDisplay()
Returns
Type | Description |
---|---|
System.String |
GetConfigurationEditor()
Gets an editor to edit the value editor configuration.
Declaration
public IConfigurationEditor GetConfigurationEditor()
Returns
Type | Description |
---|---|
IConfigurationEditor |
Remarks
If an explicit configuration editor has been assigned, then this explicit instance is returned. Otherwise, a new instance is created by CreateConfigurationEditor.
The instance created by CreateConfigurationEditor is not cached, i.e. a new instance is created each time. The property editor is a singleton, and although the configuration editor could technically be a singleton too, we'd rather not keep configuration editor cached.
GetValueEditor()
Gets a value editor.
Declaration
public IDataValueEditor GetValueEditor()
Returns
Type | Description |
---|---|
IDataValueEditor |
Remarks
If an explicit value editor has been assigned, then this explicit instance is returned. Otherwise, a new instance is created by CreateValueEditor.
The instance created by CreateValueEditor is not cached, i.e. a new instance is created each time the property value is retrieved. The property editor is a singleton, and the value editor cannot be a singleton since it depends on the datatype configuration.
Technically, it could be cached by datatype but let's keep things simple enough for now.
GetValueEditor(Object)
Gets a configured value editor.
Declaration
public virtual IDataValueEditor GetValueEditor(object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Object | configuration |
Returns
Type | Description |
---|---|
IDataValueEditor |
Remarks
If an explicit value editor has been assigned, then this explicit instance is returned. Otherwise, a new instance is created by CreateValueEditor, and configured with the configuration.
The instance created by CreateValueEditor is not cached, i.e. a new instance is created each time the property value is retrieved. The property editor is a singleton, and the value editor cannot be a singleton since it depends on the datatype configuration.
Technically, it could be cached by datatype but let's keep things simple enough for now.