Class DataEditor
Represents a data editor.
Inheritance
Namespace: Umbraco.Cms.Core.PropertyEditors
Assembly: Umbraco.Core.dll
Syntax
[DataContract]
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(IDataValueEditorFactory, EditorType)
Initializes a new instance of the DataEditor class.
Declaration
public DataEditor(IDataValueEditorFactory dataValueEditorFactory, EditorType type = EditorType.PropertyValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataValueEditorFactory | dataValueEditorFactory | |
| EditorType | type |
Properties
View SourceAlias
Gets the alias of the editor.
Declaration
[DataMember(Name = "alias", IsRequired = true)]
public string Alias { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Attribute
Gets the editor attribute.
Declaration
protected DataEditorAttribute Attribute { get; }
Property Value
| Type | Description |
|---|---|
| DataEditorAttribute |
DataValueEditorFactory
Declaration
protected IDataValueEditorFactory DataValueEditorFactory { get; }
Property Value
| Type | Description |
|---|---|
| IDataValueEditorFactory |
DefaultConfiguration
Declaration
[DataMember(Name = "defaultConfig")]
public IDictionary<string, object> DefaultConfiguration { get; set; }
Property Value
| Type | Description |
|---|---|
| IDictionary<System.String, System.Object> |
ExplicitConfigurationEditor
Gets or sets an explicit configuration editor.
Declaration
[DataMember(Name = "config")]
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
[DataMember(Name = "editor")]
public IDataValueEditor ExplicitValueEditor { get; set; }
Property Value
| Type | Description |
|---|---|
| IDataValueEditor |
Remarks
Used for manifest data editors.
Group
Gets the group of the editor.
Declaration
[DataMember(Name = "group")]
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
[DataMember(Name = "icon")]
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
[IgnoreDataMember]
public bool IsDeprecated { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Deprecated editors are supported but not proposed in the UI.
Name
Gets the name of the editor.
Declaration
[DataMember(Name = "name", IsRequired = true)]
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 |
SupportsReadOnly
Declaration
[DataMember(Name = "supportsReadOnly", IsRequired = true)]
public bool SupportsReadOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Type
Gets the type of the editor.
Declaration
[IgnoreDataMember]
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 cached if allowed by the DataEditor attribute (ValueEditorIsReusable == true).
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.