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)
Initializes a new instance of the DataEditor class.
Declaration
public DataEditor(IDataValueEditorFactory dataValueEditorFactory)
Parameters
Type | Name | Description |
---|---|---|
IDataValueEditorFactory | dataValueEditorFactory |
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.
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.
PropertyIndexValueFactory
Gets the index value factory for the editor.
Declaration
public virtual IPropertyIndexValueFactory PropertyIndexValueFactory { get; }
Property Value
Type | Description |
---|---|
IPropertyIndexValueFactory |
SupportsConfigurableElements
Declaration
public virtual bool SupportsConfigurableElements { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SupportsReadOnly
Declaration
[DataMember(Name = "supportsReadOnly", IsRequired = true)]
public bool SupportsReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
View SourceCanMergePartialPropertyValues(IPropertyType)
Determines if the value editor needs to perform MergePartialPropertyValueForCulture(Object, Object, String) for a given property type.
Declaration
public virtual bool CanMergePartialPropertyValues(IPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPropertyType | propertyType |
Returns
Type | Description |
---|---|
System.Boolean |
CreateConfigurationEditor()
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 configurationObject)
Parameters
Type | Name | Description |
---|---|---|
System.Object | configurationObject |
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.
MergePartialPropertyValueForCulture(Object, Object, String)
Partially merges a source property value into a target property value for a given culture.
Declaration
public virtual object MergePartialPropertyValueForCulture(object sourceValue, object targetValue, string culture)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sourceValue | The source property value. |
System.Object | targetValue | The target property value. |
System.String | culture | The culture (or null for invariant). |
Returns
Type | Description |
---|---|
System.Object | The result of the merge operation. |