Class ContentItemEditPageBase
Represents base content item edit page.
public abstract class ContentItemEditPageBase : Page<ContentItemClientProperties>, IPage
- Inheritance
-
objectContentItemEditPageBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ContentItemEditPageBase(IFormDataBinder, IFormComponentCommandInvoker, IFormItemCollectionProvider, IContentItemManagerFactory, IAuthenticatedUserAccessor, IPageLinkGenerator, IContentLanguageRetriever, IContentItemDisplayNameValidator)
Initializes a new instance of the ContentItemEditPageBase.
protected ContentItemEditPageBase(IFormDataBinder formDataBinder, IFormComponentCommandInvoker formComponentCommandInvoker, IFormItemCollectionProvider formItemCollectionProvider, IContentItemManagerFactory contentItemManagerFactory, IAuthenticatedUserAccessor userAccessor, IPageLinkGenerator pageLinkGenerator, IContentLanguageRetriever contentLanguageRetriever, IContentItemDisplayNameValidator contentItemDisplayNameValidator)
Parameters
formDataBinder
IFormDataBinderformComponentCommandInvoker
IFormComponentCommandInvokerformItemCollectionProvider
IFormItemCollectionProvidercontentItemManagerFactory
IContentItemManagerFactoryuserAccessor
IAuthenticatedUserAccessorpageLinkGenerator
IPageLinkGeneratorcontentLanguageRetriever
IContentLanguageRetrievercontentItemDisplayNameValidator
IContentItemDisplayNameValidator
ContentItemEditPageBase(IFormDataBinder, IFormComponentCommandInvoker, IFormItemCollectionProvider, IContentItemManagerFactory, IAuthenticatedUserAccessor, IPageUrlGenerator, IContentLanguageRetriever, IContentItemDisplayNameValidator)
Initializes a new instance of the ContentItemEditPageBase.
[Obsolete("Use constructor with pageLinkGenerator instead.")]
protected ContentItemEditPageBase(IFormDataBinder formDataBinder, IFormComponentCommandInvoker formComponentCommandInvoker, IFormItemCollectionProvider formItemCollectionProvider, IContentItemManagerFactory contentItemManagerFactory, IAuthenticatedUserAccessor userAccessor, IPageUrlGenerator pageUrlGenerator, IContentLanguageRetriever contentLanguageRetriever, IContentItemDisplayNameValidator contentItemDisplayNameValidator)
Parameters
formDataBinder
IFormDataBinderformComponentCommandInvoker
IFormComponentCommandInvokerformItemCollectionProvider
IFormItemCollectionProvidercontentItemManagerFactory
IContentItemManagerFactoryuserAccessor
IAuthenticatedUserAccessorpageUrlGenerator
IPageUrlGeneratorcontentLanguageRetriever
IContentLanguageRetrievercontentItemDisplayNameValidator
IContentItemDisplayNameValidator
Fields
MAX_DISPLAY_NAME_LENGTH
Content item display name maximum length.
protected const int MAX_DISPLAY_NAME_LENGTH = 100
Field Value
- int
Properties
ContentItemDisplayNameValidator
Content item display name validator.
protected IContentItemDisplayNameValidator ContentItemDisplayNameValidator { get; }
Property Value
- IContentItemDisplayNameValidator
ContentItemManagerFactory
Content item manager factory.
protected IContentItemManagerFactory ContentItemManagerFactory { get; }
Property Value
ContentLanguageIdentifier
Content language identifier.
[PageParameter(typeof(ContentLanguageModelBinder), typeof(ContentHubContentLanguage))]
public ContentLanguageUrlIdentifier ContentLanguageIdentifier { get; set; }
Property Value
ContentLanguageRetriever
Content language retriever.
protected IContentLanguageRetriever ContentLanguageRetriever { get; }
Property Value
- IContentLanguageRetriever
PageLinkGenerator
Page link generator.
protected IPageLinkGenerator PageLinkGenerator { get; }
Property Value
PageUrlGenerator
Page URL generator.
[Obsolete("Use PageLinkGenerator instead.")]
[ObsoleteSince(29, 5)]
protected IPageUrlGenerator PageUrlGenerator { get; }
Property Value
UserAccessor
Authenticated user accessor.
protected IAuthenticatedUserAccessor UserAccessor { get; }
Property Value
WorkspaceUrlIdentifier
Workspace identifier.
[PageParameter(typeof(WorkspaceModelBinder), typeof(ContentHubWorkspace))]
public WorkspaceUrlIdentifier WorkspaceUrlIdentifier { get; set; }
Property Value
Methods
BindComponentsToModel<T>(ICollection<IFormComponent>, CancellationToken)
Returns model with values from provided form components.
protected Task<T> BindComponentsToModel<T>(ICollection<IFormComponent> components, CancellationToken cancellationToken) where T : new()
Parameters
components
ICollection<IFormComponent>Components with values to bind to model.
cancellationToken
CancellationTokenCancellation instruction.
Returns
- Task<T>
Type Parameters
T
Type of the model.
BindContextToComponents(ICollection<IFormComponent>, CancellationToken)
Binds context to form components.
protected Task BindContextToComponents(ICollection<IFormComponent> components, CancellationToken cancellationToken = default)
Parameters
components
ICollection<IFormComponent>Form components.
cancellationToken
CancellationTokenCancellation instruction.
Returns
- Task
BindDataToComponents(ICollection<IFormComponent>, IDataContainer, CancellationToken)
Binds form data to provided form components.
protected Task BindDataToComponents(ICollection<IFormComponent> components, IDataContainer dataContainer, CancellationToken cancellationToken)
Parameters
components
ICollection<IFormComponent>Form components.
dataContainer
IDataContainerContainer holding data to be bound.
cancellationToken
CancellationTokenCancellation instruction.
Returns
- Task
BindDataToComponents(ICollection<IFormComponent>, Dictionary<string, JsonElement>, CancellationToken)
Binds provided data to the components.
protected Task BindDataToComponents(ICollection<IFormComponent> components, Dictionary<string, JsonElement> data, CancellationToken cancellationToken)
Parameters
components
ICollection<IFormComponent>Components to bind data to.
data
Dictionary<string, JsonElement>Data to bind to the components.
cancellationToken
CancellationTokenCancellation instruction.
Returns
- Task
BindDataToComponentsAndValidate(ICollection<IFormComponent>, Dictionary<string, JsonElement>, CancellationToken)
Binds form data to provided form components and validates the values.
protected Task<IFormFieldValueProvider> BindDataToComponentsAndValidate(ICollection<IFormComponent> components, Dictionary<string, JsonElement> data, CancellationToken cancellationToken)
Parameters
components
ICollection<IFormComponent>Form components.
data
Dictionary<string, JsonElement>Data to bind.
cancellationToken
CancellationTokenCancellation instruction.
Returns
- Task<IFormFieldValueProvider>
Change(ContentItemChangeCommandArguments, CancellationToken)
Evaluates change in form fields values and evaluates visibility and rules of filled fields.
public virtual Task<ICommandResponse<FormChangeResult>> Change(ContentItemChangeCommandArguments args, CancellationToken cancellationToken = default)
Parameters
args
ContentItemChangeCommandArgumentsChange data
cancellationToken
CancellationTokenThe cancellation instruction.
Returns
- Task<ICommandResponse<FormChangeResult>>
Evaluated form fields
CheckUserWorkspacePermission(string)
Checks whether the current user has workspace permission for ContentHubApplication.
protected Task CheckUserWorkspacePermission(string permissionName)
Parameters
permissionName
stringName of the workspace permission.
Returns
- Task
Exceptions
- ForbiddenAccessException
Thrown when user does not have the given permission for the current workspace.
CheckUserWorkspacePermission<TInfo>(int, string)
Checks whether the current user has permission to given item's workspace of ContentHubApplication.
protected Task CheckUserWorkspacePermission<TInfo>(int itemId, string permissionName) where TInfo : AbstractInfoBase<TInfo>, IInfoWithId, new()
Parameters
itemId
intID of the item.
permissionName
stringName of the workspace permission.
Returns
- Task
Type Parameters
TInfo
Exceptions
- ForbiddenAccessException
Thrown when user does not have the given permission for the item's workspace.
ComponentCommand(FormComponentCommandModel, CancellationToken)
Handles the form component command invocation.
public Task<object> ComponentCommand(FormComponentCommandModel commandModel, CancellationToken cancellationToken = default)
Parameters
commandModel
FormComponentCommandModelForm component command arguments.
cancellationToken
CancellationTokenThe cancellation instruction.
Returns
- Task<object>
Returns the form component command result.
CreateContentItemData(IEnumerable<IFormComponent>)
Creates ContentItemData from form components.
protected static ContentItemData CreateContentItemData(IEnumerable<IFormComponent> formComponents)
Parameters
formComponents
IEnumerable<IFormComponent>Form components.
Returns
- ContentItemData
Content item data instance.
GetContentItemManager()
Gets content item manager.
protected Task<IContentItemManager> GetContentItemManager()
Returns
- Task<IContentItemManager>
GetContentTypeIdFromFormName(string)
Gets the content type ID from the form name.
protected static int GetContentTypeIdFromFormName(string formName)
Parameters
formName
stringForm name.
Returns
- int
GetFormComponentCommandFormComponents(FormComponentCommandModel, CancellationToken)
Gets the form components for the form component command.
protected abstract Task<ICollection<IFormComponent>> GetFormComponentCommandFormComponents(FormComponentCommandModel commandModel, CancellationToken cancellationToken = default)
Parameters
commandModel
FormComponentCommandModelForm component command arguments.
cancellationToken
CancellationTokenThe cancellation instruction.
Returns
- Task<ICollection<IFormComponent>>
Returns the form components valid for the specific command.
GetFormItems(int)
Gets form items for provided content type.
protected Task<ICollection<IFormItem>> GetFormItems(int contentTypeId)
Parameters
contentTypeId
intContent type identifier.
Returns
- Task<ICollection<IFormItem>>
GetFormItemsForModel<TModel>(CancellationToken)
Gets fully initialized form items for model.
protected Task<ICollection<IFormItem>> GetFormItemsForModel<TModel>(CancellationToken cancellationToken) where TModel : new()
Parameters
cancellationToken
CancellationToken
Returns
- Task<ICollection<IFormItem>>
Type Parameters
TModel
Model for which the form items should be received.
GetValidatedComponents<TModel>(IDictionary<string, JsonElement>, CancellationToken)
Gets fully initialized form components for model, binds form data and validates.
protected Task<ICollection<IFormComponent>> GetValidatedComponents<TModel>(IDictionary<string, JsonElement> formData, CancellationToken cancellationToken) where TModel : new()
Parameters
formData
IDictionary<string, JsonElement>cancellationToken
CancellationToken
Returns
- Task<ICollection<IFormComponent>>
Type Parameters
TModel
Model for which the form components should be received.
InitializeContext(CancellationToken)
Initializes form context.
protected abstract Task<IFormContext> InitializeContext(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenCancellation instruction.
Returns
- Task<IFormContext>
PrepareFormItemsForModel<TModel>(CancellationToken)
Gets uninitialized form items for model.
protected Task<ICollection<IFormItem>> PrepareFormItemsForModel<TModel>(CancellationToken cancellationToken) where TModel : new()
Parameters
cancellationToken
CancellationToken
Returns
- Task<ICollection<IFormItem>>
Type Parameters
TModel
Model for which the form items should be received.
ValidateDisplayName(RenameCommandArguments)
Validates the content item display name.
public Task<ICommandResponse<RenameCommandResult>> ValidateDisplayName(RenameCommandArguments args)
Parameters
args
RenameCommandArgumentsRename command arguments.