Kernel::WebApp::Controller::API::Role::ProvidesForm

NAME

Kernel::WebApp::Controller::API::Role::ProvidesForm – Role for form endpoints to return the schema and validate the data.

DESCRIPTION

This role re-implements the 'Handler' and two phases, 'DataValidate' and 'Action'.

The 'Handler' identify if the form is to be validated or not. The 'DataValidate' performs the form validation. The 'Action' just returns the form schema.

PUBLIC INTERFACE

FormSchema

Return the form schema that the form object will use to build itself.

Returns

    - an hashref with the following format:
    {
        Fields => [

        ],
    }

has DoValidateFormData

Attribute that holds the state if the form should be validated or not.

has OnlyFormChangeTime

Attribute that holds the state if the form should only return the 'ChangeTime' information.

has IsInitialRequest

Attribute that holds the information if the form performs the initial request or not.

has DefaultConfigurableFormConfig

Attribute that holds the current config of the configurable form.

Form()

Accessor for the form object. It checks if the object was already created, if not, it will create it.

HasCollision()

Verifies if there's a data collision according to the data 'ChangeTime'.

Returns

    1 - there is a collision
    0 - there is no collision

FormChangeTime()

Should return the current change time for the data in the form. This information is used to detect collisions.

FormName()

Should return the form name. This information is used to check if there is a custom configuration of the schema in the system configuration.

FormConfig()

If FormName is defined, it will get the config setting and return the parsed perl structure.

PRIVATE INTERFACE

has _Form

Attribute that holds the reference of the form object.

_BuildIsInitialRequest()

Initializes the attribute IsInitialRequest.

_BuildDefaultConfigurableFormConfig()

Initializes the attribute DefaultConfigurableFormConfig. Inspects the information from the form config,

_BuildFormSignature()

Initializes the attribute FormSignature.

_ProvidesFormRender()

Sets the endpoint response.

Scroll to Top