Class ConfigurationEditor
Represents a data type configuration editor.
Inheritance
Namespace: Umbraco.Core.PropertyEditors
Assembly: Umbraco.Core.dll
Syntax
public class ConfigurationEditor : IConfigurationEditor
Constructors
View SourceConfigurationEditor()
Initializes a new instance of the ConfigurationEditor class.
Declaration
public ConfigurationEditor()
ConfigurationEditor(List<ConfigurationField>)
Initializes a new instance of the ConfigurationEditor class.
Declaration
protected ConfigurationEditor(List<ConfigurationField> fields)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ConfigurationField> | fields |
Properties
View SourceConfigurationJsonSettings
Gets the custom json serializer settings for configurations.
Declaration
public static JsonSerializerSettings ConfigurationJsonSettings { get; }
Property Value
Type | Description |
---|---|
JsonSerializerSettings |
DefaultConfiguration
Gets the default configuration.
Declaration
public virtual IDictionary<string, object> DefaultConfiguration { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.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 virtual 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
.
Fields
Gets the fields.
Declaration
public List<ConfigurationField> Fields { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ConfigurationField> |
Methods
View SourceConfigurationAs<TConfiguration>(Object)
Gets the configuration as a typed object.
Declaration
public static TConfiguration ConfigurationAs<TConfiguration>(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
TConfiguration |
Type Parameters
Name | Description |
---|---|
TConfiguration |
Field(String)
Gets a field by its property name.
Declaration
protected ConfigurationField Field(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
ConfigurationField |
Remarks
Can be used in constructors to add infos to a field that has been defined by a property marked with the ConfigurationFieldAttribute.
FromConfigurationEditor(IDictionary<String, Object>, Object)
Converts the values posted by the configuration editor into the actual configuration object.
Declaration
public virtual object FromConfigurationEditor(IDictionary<string, object> editorValues, object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.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)
Converts the serialized database value into the actual configuration object.
Declaration
public virtual object FromDatabase(string configurationJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | configurationJson |
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).
IsConfiguration(Object)
Determines whether a configuration object is of the type expected by the configuration editor.
Declaration
public virtual bool IsConfiguration(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
ToConfigurationEditor(Object)
Converts the configuration object to values for the configuration editor.
Declaration
public virtual IDictionary<string, object> ToConfigurationEditor(object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Object | configuration | The configuration. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |
ToDatabase(Object)
Converts a configuration object into a serialized database value.
Declaration
public static string ToDatabase(object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Object | configuration |
Returns
Type | Description |
---|---|
System.String |
ToValueEditor(Object)
Converts the configuration object to values for the value editor.
Declaration
public virtual IDictionary<string, object> ToValueEditor(object configuration)
Parameters
Type | Name | Description |
---|---|---|
System.Object | configuration | The configuration. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |