Table of Contents

Class FormComponentPropertiesMapper

Namespace
Kentico.Forms.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Contains mapping methods for conversions between form component properties and form field definition.

public class FormComponentPropertiesMapper : IFormComponentPropertiesMapper
Inheritance
object
FormComponentPropertiesMapper
Implements
Extension Methods

Constructors

FormComponentPropertiesMapper(IFormComponentDefinitionProvider, IFormComponentActivator, IEditablePropertiesCollector, IValidationRuleConfigurationsXmlSerializer, IVisibilityConditionConfigurationXmlSerializer)

Initializes a new instance of the FormComponentPropertiesMapper class.

public FormComponentPropertiesMapper(IFormComponentDefinitionProvider formComponentDefinitionProvider, IFormComponentActivator formComponentActivator, IEditablePropertiesCollector editablePropertiesCollector, IValidationRuleConfigurationsXmlSerializer validationRuleConfigurationsXmlSerializer, IVisibilityConditionConfigurationXmlSerializer visibilityConditionConfigurationXmlSerializer)

Parameters

formComponentDefinitionProvider IFormComponentDefinitionProvider

Provider for registered form components retrieval.

formComponentActivator IFormComponentActivator

Activator for form components.

editablePropertiesCollector IEditablePropertiesCollector

Collects editable properties from a model.

validationRuleConfigurationsXmlSerializer IValidationRuleConfigurationsXmlSerializer

Serializer for validation rules stored in ValidationRuleConfigurationsXmlData.

visibilityConditionConfigurationXmlSerializer IVisibilityConditionConfigurationXmlSerializer

Serializer for visibility condition stored in VisibilityConditionConfigurationXmlData.

Methods

FromFieldInfo(FormFieldInfo)

Maps an instance of FormFieldInfo to corresponding FormComponentProperties. To extract identifier of corresponding FormComponentDefinition use GetComponentIdentifier(FormFieldInfo).

public virtual FormComponentProperties FromFieldInfo(FormFieldInfo formFieldInfo)

Parameters

formFieldInfo FormFieldInfo

Form field to be mapped.

Returns

FormComponentProperties

Returns an instance of FormComponentProperties which corresponds to given form field.

Exceptions

ArgumentNullException

Thrown when formFieldInfo is null.

InvalidOperationException

Thrown when formFieldInfo contains an unknown form component identifier

-or-

when corresponding component properties contain a property of type which is not supported by DataTypeManager.

GetComponentIdentifier(FormFieldInfo)

Gets FormComponentDefinition identifier stored in formFieldInfo.

public virtual string GetComponentIdentifier(FormFieldInfo formFieldInfo)

Parameters

formFieldInfo FormFieldInfo

Form field info for which to obtain FormComponentDefinition's identifier.

Returns

string

Return identifier obtained from formFieldInfo.

Exceptions

ArgumentNullException

Thrown when formFieldInfo is null.

InvalidOperationException

Thrown when formFieldInfo does not specify a form component identifier.

ToFormFieldInfo(FormComponentProperties, string)

Maps an instance of FormComponentProperties to corresponding FormFieldInfo.

public virtual FormFieldInfo ToFormFieldInfo(FormComponentProperties formComponentProperties, string componentIdentifier)

Parameters

formComponentProperties FormComponentProperties

Form component properties to be mapped.

componentIdentifier string

Identifier of corresponding FormComponentDefinition to be stored along with formComponentProperties.

Returns

FormFieldInfo

Returns an instance of FormFieldInfo which corresponds to given properties and type identifier.

Exceptions

ArgumentNullException

Thrown when formComponentProperties is null.

InvalidOperationException

Thrown when formComponentProperties contain a property of type which is not supported by DataTypeManager.

See Also