Table of Contents

Class InfoEditPageBase<TInfo>

Namespace
Kentico.Xperience.Admin.Base
Assembly
Kentico.Xperience.Admin.Base.dll

Represents base edit page for pages based on TInfo.

public abstract class InfoEditPageBase<TInfo> : EditPageBase, IPage where TInfo : AbstractInfoBase<TInfo>, new()

Type Parameters

TInfo

Info object

Inheritance
object
InfoEditPageBase<TInfo>
Implements
Derived
Inherited Members
Extension Methods

Constructors

InfoEditPageBase(IFormComponentMapper, IFormDataBinder)

Initializes a new instance of the InfoEditPageBase<TInfo> class using the form component mapper and form data binder.

protected InfoEditPageBase(IFormComponentMapper mapper, IFormDataBinder formDataBinder)

Parameters

mapper IFormComponentMapper
formDataBinder IFormDataBinder

Exceptions

InvalidOperationException

When provider for ObjectType was not found.

Properties

FormComponentMapper

Gets mapper from form definition to form components and fields.

protected IFormComponentMapper FormComponentMapper { get; }

Property Value

IFormComponentMapper

ObjectType

Type of the info objects that are edited. Corresponds to the OBJECT_TYPE property of the info object or PredefinedObjectType.

protected virtual string ObjectType { get; }

Property Value

string

Methods

BindComponentsToInfoObject(TInfo, ICollection<IFormComponent>)

Binds values of components in components to edited infoObject.

protected void BindComponentsToInfoObject(TInfo infoObject, ICollection<IFormComponent> components)

Parameters

infoObject TInfo

Info object to bind values retrieved from form components.

components ICollection<IFormComponent>

Form components to bind data from.

BindInfoObjectToComponents(TInfo, ICollection<IFormComponent>)

Binds data of object to form components in components.

protected Task BindInfoObjectToComponents(TInfo infoObject, ICollection<IFormComponent> components)

Parameters

infoObject TInfo

Edited object instance.

components ICollection<IFormComponent>

Components to bind data to.

Returns

Task

Exceptions

InvalidOperationException

Thrown when object instance is null.

ConfigurePage()

Set up page's configuration. Configures the submit action.

public override Task ConfigurePage()

Returns

Task

ConfigureTemplateProperties(EditTemplateClientProperties)

Transforms the configuration to template properties.

public override Task<EditTemplateClientProperties> ConfigureTemplateProperties(EditTemplateClientProperties properties)

Parameters

properties EditTemplateClientProperties

Returns

Task<EditTemplateClientProperties>

Remarks

Performs also permission evaluation.

FinalizeInfoObject(TInfo, IFormFieldValueProvider, CancellationToken)

Allows to modify values of infoObject before validation and saving.

protected virtual Task FinalizeInfoObject(TInfo infoObject, IFormFieldValueProvider fieldValueProvider, CancellationToken cancellationToken)

Parameters

infoObject TInfo

Info object to be set.

fieldValueProvider IFormFieldValueProvider

Provider of form field values.

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task

GetDefaultUIFormName()

Returns default UI form name.

protected abstract string GetDefaultUIFormName()

Returns

string

GetFormComponents(IEnumerable<FormFieldInfo>)

Gets collection of form components for editing given fields.

protected ICollection<IFormComponent> GetFormComponents(IEnumerable<FormFieldInfo> formFields)

Parameters

formFields IEnumerable<FormFieldInfo>

Form fields to return form components for.

Returns

ICollection<IFormComponent>

Returns the collection of form components for formFields.

GetFormElements()

Lists IDataDefinitionItems from object's form definition.

protected Task<IList<IDataDefinitionItem>> GetFormElements()

Returns

Task<IList<IDataDefinitionItem>>

Returns the list of both form fields and categories.

GetFormFieldInfos()

Lists FormFieldInfos from object's form definition.

protected Task<ICollection<FormFieldInfo>> GetFormFieldInfos()

Returns

Task<ICollection<FormFieldInfo>>

Returns the list of form fields.

GetFormItems()

Prepares form items for editing object of the specified ObjectType.

protected override Task<ICollection<IFormItem>> GetFormItems()

Returns

Task<ICollection<IFormItem>>

Returns the collection of form items.

GetFormItemsClientProperties()

Returns properties describing client form components for editing object.

protected override Task<IEnumerable<IFormItemClientProperties>> GetFormItemsClientProperties()

Returns

Task<IEnumerable<IFormItemClientProperties>>

Exceptions

InvalidOperationException

Thrown when object instance is null or data class info for ObjectType was not found.

GetInfoObject(CancellationToken?)

Gets info object.

protected abstract Task<TInfo> GetInfoObject(CancellationToken? cancellationToken = null)

Parameters

cancellationToken CancellationToken?

The cancellation instruction.

Returns

Task<TInfo>

GetObjectDisplayName(TInfo)

Gets object display name to be used in breadcrumbs, navigation items etc. if they have to be updated after the Submit(FormSubmissionCommandArguments) command success.

protected virtual Task<string> GetObjectDisplayName(TInfo infoObject)

Parameters

infoObject TInfo

Currently processed info object.

Returns

Task<string>

The object display name to be used in breadcrumbs, navigation items etc., or null, should the display name not be changed after the Submit(FormSubmissionCommandArguments) command success.

See Also

GetPagePermissionEvaluator()

Gets the permission evaluator for the current page.

protected override Task<Func<string, Task<PermissionEvaluationResult>>> GetPagePermissionEvaluator()

Returns

Task<Func<string, Task<PermissionEvaluationResult>>>

Remarks

Default implementation uses the IUIPermissionEvaluator.

GetSubmitSuccessResponse(TInfo, ICollection<IFormItem>)

Response that has to be returned after successful form submission.

protected virtual Task<ICommandResponse> GetSubmitSuccessResponse(TInfo savedInfoObject, ICollection<IFormItem> items)

Parameters

savedInfoObject TInfo

Object info after persisting.

items ICollection<IFormItem>

Collection with updated form items.

Returns

Task<ICommandResponse>

InitializeContext()

Initializes form context.

protected override Task<IFormContext> InitializeContext()

Returns

Task<IFormContext>

RegisterMacroField(MacroField)

Registers given field globally to form macro resolver.

public void RegisterMacroField(MacroField field)

Parameters

field MacroField

SetFormData(TInfo, IFormFieldValueProvider)

Sets the infoObject.

protected virtual Task SetFormData(TInfo infoObject, IFormFieldValueProvider fieldValueProvider)

Parameters

infoObject TInfo

Info object to be set.

fieldValueProvider IFormFieldValueProvider

Provider of form field values.

Returns

Task

SubmitInternal(FormSubmissionCommandArguments, ICollection<IFormItem>, IFormFieldValueProvider)

Handles the internal specific processing of form submit command.

protected override Task<ICommandResponse> SubmitInternal(FormSubmissionCommandArguments args, ICollection<IFormItem> items, IFormFieldValueProvider formFieldValueProvider)

Parameters

args FormSubmissionCommandArguments

Form submission arguments.

items ICollection<IFormItem>

Form items with bound component values.

formFieldValueProvider IFormFieldValueProvider

Provider of form field values.

Returns

Task<ICommandResponse>

Returns the form submission result.

Remarks

This method is called by the default implementation of the Submit(FormSubmissionCommandArguments) method.

See Also

ValidatePage()

Validates the page state prior invocation of the ConfigurePage() method.

public override Task<PageValidationResult> ValidatePage()

Returns

Task<PageValidationResult>