FieldsManager
class FieldsManager (View source)
Class to manage fields
Properties
| DoliDB | $db | ||
| string | $error | ||
| string[] | $errors | ||
| array<string, string> | $validateFieldsErrors | ||
| string | $fieldsPath | ||
| static CommonField> | $fieldClasses | ||
| static FieldInfos>}>> | $fieldInfos | ||
| array<string, bool|int<0, 1>>|null | $expand_display |
Methods
Get field handler for the provided type
Get all fields handler available
clear errors
Method to output saved errors
clear validation message result for a field
set validation error message a field
get field error message
get field error icon
Get list of fields infos for the provided mode into X columns
Get list of object fields infos
Get list of extra fields infos
Get list of fields infos for the provided mode into X columns
Get field infos from object field infos
Get field infos from extra field infos
Set common field infos
Set all values of the object (with extra field) from POST
Set all object values of the object from POST
Set all extra field values of the object from POST
Verify if the field value is valid
Verify if the field value is valid
Get field value from GET/POST
Get search field value from GET/POST
Return HTML string to put an input search field into a page
Return HTML string to put an input field into a page
Return HTML string to show a field into a page
Return HTML string to print separator field
Details
CommonField|null
getFieldClass(string $type)
Get field handler for the provided type
CommonField>
getAllFields()
Get all fields handler available
void
clearErrors()
clear errors
string
errorsToString(string $separator = ', ')
Method to output saved errors
void
clearFieldError(string $fieldKey)
clear validation message result for a field
void
setFieldError(string $fieldKey, string $msg = '')
set validation error message a field
string
getFieldError(string $fieldKey)
get field error message
string
getFieldErrorIcon(string $fieldValidationErrorMsg)
get field error icon
FieldInfos>}
getAllFieldsInfos(CommonObject $object, ExtraFields $extrafields = null, string $mode = 'view', int $nbColumn = 2, array<int, string> $breakKeys = array(), array<string, mixed> $params = array())
Get list of fields infos for the provided mode into X columns
FieldInfos>
getAllObjectFieldsInfos(CommonObject $object, string $mode = 'view', array<string, mixed> $params = array())
Get list of object fields infos
FieldInfos>
getAllExtraFieldsInfos(CommonObject $object, ExtraFields $extrafields = null, string $mode = 'view', array<string, mixed> $params = array())
Get list of extra fields infos
FieldInfos|null
getFieldsInfos(string $key, CommonObject $object, ExtraFields $extrafields = null, string $mode = 'view', array<string, mixed> $params = array())
Get list of fields infos for the provided mode into X columns
FieldInfos|null
getFieldInfosFromObjectField(CommonObject $object, string $key, string $mode = 'view', array<string, mixed> $params = array())
Get field infos from object field infos
FieldInfos|null
getFieldInfosFromExtraField(CommonObject $object, ExtraFields $extrafields, string $key, string $mode = 'view', array<string, mixed> $params = array())
Get field infos from extra field infos
void
setCommonFieldInfos(FieldInfos $fieldInfos, CommonObject $object, ExtraFields $extrafields, string $key, string $mode = 'view', string $enabled = '1', string $visibility = '', string $perms = null, array<string, mixed> $params = array())
Set common field infos
int
setFieldValuesFromPost(CommonObject $object, ExtraFields $extrafields, string $keyPrefix = '', string $keySuffix = '', string $mode = 'view', array<string, mixed> $params = array())
Set all values of the object (with extra field) from POST
int
setObjectFieldValuesFromPost(CommonObject $object, string $keyPrefix = '', string $keySuffix = '', string $mode = 'view', array<string, mixed> $params = array())
Set all object values of the object from POST
int
setExtraFieldValuesFromPost(CommonObject $object, ExtraFields $extrafields, string $keyPrefix = '', string $keySuffix = '', string $mode = 'view', array<string, mixed> $params = array())
Set all extra field values of the object from POST
bool
verifyPostFieldValue(FieldInfos $fieldInfos, string $key, string $keyPrefix = '', string $keySuffix = '')
Verify if the field value is valid
bool
verifyFieldValue(FieldInfos $fieldInfos, string $key, mixed $value)
Verify if the field value is valid
mixed
getPostFieldValue(FieldInfos $fieldInfos, string $key, mixed $defaultValue = null, string $keyPrefix = '', string $keySuffix = '')
Get field value from GET/POST
mixed
getPostSearchFieldValue(FieldInfos $fieldInfos, string $key, mixed $defaultValue = null, string $keyPrefix = '', string $keySuffix = '')
Get search field value from GET/POST
string
printInputSearchField(FieldInfos $fieldInfos, string $key, mixed $value, string $keyPrefix = '', string $keySuffix = '', string $moreCss = '', string $moreAttrib = '', int<0, 1> $noNewButton = 0)
Return HTML string to put an input search field into a page
string
printInputField(FieldInfos $fieldInfos, string $key, mixed $value, string $keyPrefix = '', string $keySuffix = '', string $moreCss = '', string $moreAttrib = '', int<0, 1> $noNewButton = 0)
Return HTML string to put an input field into a page
string
printOutputField(FieldInfos $fieldInfos, string $key, mixed $value, string $keyPrefix = '', string $keySuffix = '', string $moreCss = '', string $moreAttrib = '')
Return HTML string to show a field into a page
string
printSeparator(string $key, object $object, int $colspan = 2, string $display_type = 'card', string $mode = 'view')
Return HTML string to print separator field