Class Slug
Inherited Members
Namespace: DataWeb.Data.Controls
Assembly: DataWeb.Core.dll
Syntax
public class Slug : Control
Constructors
Slug(Form, IServiceProvider)
Declaration
public Slug(Form form, IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Form | form | |
| IServiceProvider | serviceProvider |
Methods
ProcessOnTranslateAsync(object, Dictionary<string, string>, Dictionary<string, object>, string, string, IUser, string, NavigationContext, CancellationToken)
Processes the control value during a translation operation. Override to apply culture-specific transformations. The base implementation returns the value unchanged.
Declaration
public override Task<object> ProcessOnTranslateAsync(object value, Dictionary<string, string> translatedValues, Dictionary<string, object> sectionData, string culture, string sourceCulture, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to process. |
| Dictionary<string, string> | translatedValues | A dictionary of already-translated values keyed by field name. |
| Dictionary<string, object> | sectionData | The section data associated with the current item. |
| string | culture | The target culture (e.g. |
| string | sourceCulture | The source culture from which the translation originates. |
| IUser | user | The IUser performing the translation. |
| string | itemId | The Id of the item being translated, if applicable. |
| NavigationContext | navigationContext | The NavigationContext, if applicable. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<object> | A task that represents the asynchronous operation and returns the processed value. |
Overrides
ValidateAsync(object, List<ProvidedValue>, Dictionary<string, object>, IUser, string, NavigationContext, CancellationToken)
Validates the control value asynchronously. The base implementation checks whether the control is required (via ValidateControlIsRequired(object)) and whether the value matches the declared DataType (via ValidateControlDataType(object)).
Declaration
public override Task<List<ValidationError>> ValidateAsync(object value, List<Form.ProvidedValue> providedValues, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value of the control to validate. |
| List<Form.ProvidedValue> | providedValues | All values provided for the form submission. |
| Dictionary<string, object> | sectionData | The section data associated with the current item. |
| IUser | user | The IUser submitting the form. |
| string | itemId | The Id of the item being edited, or |
| NavigationContext | navigationContext | The NavigationContext of the form, if applicable. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<List<ValidationError>> | A task that represents the asynchronous operation and returns the list of validation errors, if any. |