Class ConfigurationEditor<TConfiguration>
Represents a data type configuration editor with a typed configuration.
Namespace: Umbraco.Cms.Core.PropertyEditors
Assembly: Umbraco.Core.dll
Syntax
public abstract class ConfigurationEditor<TConfiguration> : ConfigurationEditor, IConfigurationEditor where TConfiguration : new()
Type Parameters
Name | Description |
---|---|
TConfiguration |
Constructors
View SourceConfigurationEditor(IIOHelper)
Declaration
protected ConfigurationEditor(IIOHelper ioHelper)
Parameters
Type | Name | Description |
---|---|---|
IIOHelper | ioHelper |
ConfigurationEditor(IIOHelper, IEditorConfigurationParser)
Initializes a new instance of the ConfigurationEditor<TConfiguration> class.
Declaration
protected ConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser)
Parameters
Type | Name | Description |
---|---|---|
IIOHelper | ioHelper | |
IEditorConfigurationParser | editorConfigurationParser |
Properties
View SourceDefaultConfiguration
Gets the default configuration.
Declaration
public override IDictionary<string, object> DefaultConfiguration { get; }
Property Value
Type | Description |
---|---|
IDictionary<System.String, System.Object> |
Remarks
For basic configuration editors, this will be a dictionary of key/values. For advanced editors
which inherit from ConfigurationEditor<TConfiguration>, this will be the dictionary
equivalent of an actual configuration object (ie an instance of TConfiguration
, obtained
via ToConfigurationEditor(Object).
DefaultConfigurationObject
Gets the default configuration object.
Declaration
public override object DefaultConfigurationObject { get; }
Property Value
Type | Description |
---|---|
System.Object |
Remarks
For basic configuration editors, this will be DefaultConfiguration, ie a
dictionary of key/values. For advanced editors which inherit from
ConfigurationEditor<TConfiguration>,
this will be an actual configuration object (ie an instance of TConfiguration
.
Methods
View SourceFromConfigurationEditor(Nullable<IDictionary<String, Object>>, TConfiguration)
Converts the configuration posted by the editor.
Declaration
public virtual TConfiguration FromConfigurationEditor(IDictionary<string, object>? editorValues, TConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<IDictionary<System.String, System.Object>> | editorValues | The configuration object posted by the editor. |
TConfiguration | configuration | The current configuration object. |
Returns
Type | Description |
---|---|
TConfiguration |
FromConfigurationEditor(Nullable<IDictionary<String, Object>>, Object)
Converts the values posted by the configuration editor into the actual configuration object.
Declaration
public sealed override object FromConfigurationEditor(IDictionary<string, object>? editorValues, object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<IDictionary<System.String, System.Object>> | editorValues | The values posted by the configuration editor. |
System.Object | configuration | The current configuration object. |
Returns
Type | Description |
---|---|
System.Object |
FromDatabase(String, IConfigurationEditorJsonSerializer)
Converts the serialized database value into the actual configuration object.
Declaration
public override object FromDatabase(string configuration, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer)
Parameters
Type | Name | Description |
---|---|---|
System.String | configuration | |
IConfigurationEditorJsonSerializer | configurationEditorJsonSerializer |
Returns
Type | Description |
---|---|
System.Object |
Remarks
Converting the configuration object to the serialized database value is achieved by simply serializing the configuration. See ToDatabase(Object, IConfigurationEditorJsonSerializer).
IsConfiguration(Object)
Determines whether a configuration object is of the type expected by the configuration editor.
Declaration
public override bool IsConfiguration(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
ToConfigurationEditor(TConfiguration)
Converts configuration values to values for the editor.
Declaration
public virtual Dictionary<string, object> ToConfigurationEditor(TConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | configuration | The configuration. |
Returns
Type | Description |
---|---|
Umbraco.Cms.Core.Dictionary<System.String, System.Object> |
ToConfigurationEditor(Object)
Converts the configuration object to values for the configuration editor.
Declaration
public sealed override IDictionary<string, object> ToConfigurationEditor(object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Object | configuration | The configuration. |
Returns
Type | Description |
---|---|
IDictionary<System.String, System.Object> |