dolibarr 24.0.0-beta
FormSetupItem Class Reference

This class help to create item for class formSetup. More...

Public Member Functions

 __construct ($confKey)
 Constructor.
 
 loadValueFromConf ()
 load conf value from databases
 
 reloadValueFromConf ()
 Reload conf value from databases is an alias of loadValueFromConf.
 
 saveConfValue ()
 Save const value based on htdocs/core/actions_setmoduleoptions.inc.php.
 
 setSaveCallBack (callable $callBack)
 Set an override function for saving data.
 
 setValueFromPostCallBack (callable $callBack)
 Set an override function for get data from post.
 
 setValueFromPost ()
 Save const value based on htdocs/core/actions_setmoduleoptions.inc.php.
 
 getHelpText ()
 Get help text or generate it.
 
 getNameText ()
 Get field name text or generate it.
 
 generateInputField ()
 generate input field
 
 generateInputFieldText ()
 Generate default input field.
 
 generateInputFieldPrice ()
 Generate default input field.
 
 generateInputFieldEmail ()
 Generate default input field.
 
 generateInputFieldUrl ()
 Generate default input field.
 
 generateInputFieldTextarea ()
 generate input field for textarea
 
 generateInputFieldHtml ()
 generate input field for html
 
 generateInputFieldCategories ()
 generate input field for categories
 
 generateInputFieldEmailTemplate ()
 generate input field for email template selector
 
 generateInputFieldSecureKey ()
 generate input field for secure key
 
 generateInputFieldPassword ($type='generic', $defaultmin=6, $defaultmax=50)
 generate input field for a password
 
 generateInputFieldMultiSelect ()
 generateInputFieldMultiSelect
 
 generateInputFieldSelect ()
 generateInputFieldSelect
 
 generateInputFieldRadio ()
 generateInputFieldSelect
 
 generateInputFieldSelectUser ()
 
 getType ()
 get the type : used for old module builder setup conf style conversion and tests because this two class will quickly evolve it's important to not set or get directly $this->type (will be protected) so this method exist to be sure we can manage evolution easily
 
 setTypeFromTypeString ($type)
 set the type from string : used for old module builder setup conf style conversion and tests because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist to be sure we can manage evolution easily
 
 setErrors ($errors)
 Add error.
 
 generateOutputField ()
 generateOutputField
 
 generateOutputFieldMultiSelect ()
 generateOutputFieldMultiSelect
 
 generateOutputFieldColor ()
 generateOutputFieldColor
 
 generateInputFieldColor ()
 generateInputFieldColor
 
 generateOutputFieldSelect ()
 generateOutputFieldSelect
 
 generateOutputFieldSelectUser ()
 generateOutputFieldSelectUser
 
 setAsString ()
 Set type of input as string.
 
 setAsNumber ($min=null, $max=null, $step=null)
 Set type of input as number.
 
 setAsEmail ()
 Set type of input as string.
 
 setAsUrl ()
 Set type of input as string.
 
 setAsColor ()
 Set type of input as color.
 
 setAsTextarea ()
 Set type of input as textarea.
 
 setAsHtml ()
 Set type of input as html editor.
 
 setAsEmailTemplate ($templateType)
 Set type of input as emailtemplate selector.
 
 setAsThirdpartyType ()
 Set type of input as thirdparty_type selector.
 
 setAsYesNo ()
 Set type of input as Yes.
 
 setAsSecureKey ()
 Set type of input as secure key.
 
 setAsProduct ()
 Set type of input as product.
 
 setAsPrice ()
 Set type of input as product.
 
 setAsCategory ($catType)
 Set type of input as a category selector TODO add default value.
 
 setAsTitle ()
 Set type of input as a simple title.
 
 setAsMultiSelect ($fieldOptions)
 Set type of input as a multiselect list.
 
 setAsSelect ($fieldOptions)
 Set type of input as a select list.
 
 setAsRadio ($fieldOptions)
 Set type of input as a radio button.
 
 setAsSelectUser ()
 Set type of input as a selection of a user from dolibarr users list.
 
 setAsSelectBankAccount ()
 Set type of input as a bank account selection from dolibarr bank accounts list.
 
 setAsPassword ()
 Set type of input as a password with dolibarr password rules apply.
 
 setAsGenericPassword ()
 Set type of input as a generic password without dolibarr password rules (for external passwords for example).
 

Detailed Description

This class help to create item for class formSetup.

Definition at line 628 of file html.formsetup.class.php.

Constructor & Destructor Documentation

◆ __construct()

FormSetupItem::__construct ( $confKey)

Constructor.

Parameters
string$confKeythe conf key used in database

Definition at line 724 of file html.formsetup.class.php.

References $conf, $db, and loadValueFromConf().

Member Function Documentation

◆ generateInputField()

FormSetupItem::generateInputField ( )

generate input field

Returns
bool|string

Definition at line 913 of file html.formsetup.class.php.

References $conf, fieldInputCallBack, img_picto(), isModEnabled(), and type.

◆ generateInputFieldCategories()

FormSetupItem::generateInputFieldCategories ( )

generate input field for categories

Returns
string

Definition at line 1108 of file html.formsetup.class.php.

References img_picto(), and type.

◆ generateInputFieldColor()

FormSetupItem::generateInputFieldColor ( )

generateInputFieldColor

Returns
string

Definition at line 1504 of file html.formsetup.class.php.

References colorArrayToHex(), and colorStringToArray().

◆ generateInputFieldEmail()

FormSetupItem::generateInputFieldEmail ( )

Generate default input field.

Returns
string

Definition at line 1057 of file html.formsetup.class.php.

References FormSetup\generateAttributesStringFromArray(), and img_picto().

◆ generateInputFieldEmailTemplate()

FormSetupItem::generateInputFieldEmailTemplate ( )

generate input field for email template selector

Returns
string

Definition at line 1130 of file html.formsetup.class.php.

References type.

◆ generateInputFieldHtml()

FormSetupItem::generateInputFieldHtml ( )

generate input field for html

Returns
string

Definition at line 1096 of file html.formsetup.class.php.

References isModEnabled().

◆ generateInputFieldMultiSelect()

FormSetupItem::generateInputFieldMultiSelect ( )

generateInputFieldMultiSelect

Returns
string

Definition at line 1228 of file html.formsetup.class.php.

◆ generateInputFieldPassword()

FormSetupItem::generateInputFieldPassword ( $type = 'generic',
$defaultmin = 6,
$defaultmax = 50 )

generate input field for a password

Parameters
string$type'dolibarr' (dolibarr password rules apply) or 'generic'
int$defaultminMin nb of chars
int$defaultmaxMax nb of chars
Returns
string

Definition at line 1189 of file html.formsetup.class.php.

References $conf, getDolGlobalString(), and GETPOST().

◆ generateInputFieldPrice()

FormSetupItem::generateInputFieldPrice ( )

Generate default input field.

Returns
string

Definition at line 1041 of file html.formsetup.class.php.

References $mysoc.

◆ generateInputFieldRadio()

FormSetupItem::generateInputFieldRadio ( )

generateInputFieldSelect

Returns
string

Definition at line 1260 of file html.formsetup.class.php.

References img_picto().

◆ generateInputFieldSecureKey()

FormSetupItem::generateInputFieldSecureKey ( )

generate input field for secure key

Returns
string

Definition at line 1164 of file html.formsetup.class.php.

References $conf, dolJSToSetRandomPassword(), and GETPOST().

◆ generateInputFieldSelect()

FormSetupItem::generateInputFieldSelect ( )

generateInputFieldSelect

Returns
string

Definition at line 1243 of file html.formsetup.class.php.

References img_picto().

◆ generateInputFieldSelectUser()

FormSetupItem::generateInputFieldSelectUser ( )
Returns
string

Definition at line 1275 of file html.formsetup.class.php.

◆ generateInputFieldText()

FormSetupItem::generateInputFieldText ( )

Generate default input field.

Returns
string

Definition at line 1028 of file html.formsetup.class.php.

◆ generateInputFieldTextarea()

FormSetupItem::generateInputFieldTextarea ( )

generate input field for textarea

Returns
string

Definition at line 1083 of file html.formsetup.class.php.

References dol_htmlentities().

◆ generateInputFieldUrl()

FormSetupItem::generateInputFieldUrl ( )

Generate default input field.

Returns
string

Definition at line 1070 of file html.formsetup.class.php.

References FormSetup\generateAttributesStringFromArray(), and img_picto().

◆ generateOutputField()

FormSetupItem::generateOutputField ( )

generateOutputField

Returns
bool|string Generate the output html for this item

Definition at line 1333 of file html.formsetup.class.php.

References $c, $conf, dol_nl2br(), dolPrintHTML(), and type.

◆ generateOutputFieldColor()

FormSetupItem::generateOutputFieldColor ( )

generateOutputFieldColor

Returns
string

Definition at line 1476 of file html.formsetup.class.php.

References colorArrayToHex(), and colorStringToArray().

◆ generateOutputFieldMultiSelect()

FormSetupItem::generateOutputFieldMultiSelect ( )

generateOutputFieldMultiSelect

Returns
string

Definition at line 1453 of file html.formsetup.class.php.

◆ generateOutputFieldSelect()

FormSetupItem::generateOutputFieldSelect ( )

generateOutputFieldSelect

Returns
string

Definition at line 1518 of file html.formsetup.class.php.

◆ generateOutputFieldSelectUser()

FormSetupItem::generateOutputFieldSelectUser ( )

generateOutputFieldSelectUser

Returns
string

Definition at line 1533 of file html.formsetup.class.php.

◆ getHelpText()

FormSetupItem::getHelpText ( )

Get help text or generate it.

Returns
int|string

Definition at line 880 of file html.formsetup.class.php.

◆ getNameText()

FormSetupItem::getNameText ( )

Get field name text or generate it.

Returns
false|int|string

Definition at line 893 of file html.formsetup.class.php.

References img_picto(), and isModEnabled().

◆ getType()

FormSetupItem::getType ( )

get the type : used for old module builder setup conf style conversion and tests because this two class will quickly evolve it's important to not set or get directly $this->type (will be protected) so this method exist to be sure we can manage evolution easily

Returns
string

Definition at line 1287 of file html.formsetup.class.php.

◆ loadValueFromConf()

FormSetupItem::loadValueFromConf ( )

load conf value from databases

Returns
bool

Definition at line 747 of file html.formsetup.class.php.

References $conf.

Referenced by __construct().

◆ reloadValueFromConf()

FormSetupItem::reloadValueFromConf ( )

Reload conf value from databases is an alias of loadValueFromConf.

Deprecated
Returns
bool

Definition at line 765 of file html.formsetup.class.php.

◆ saveConfValue()

FormSetupItem::saveConfValue ( )

Save const value based on htdocs/core/actions_setmoduleoptions.inc.php.

Returns
int -1 if KO, 1 if OK

Definition at line 776 of file html.formsetup.class.php.

References dolibarr_set_const(), and type.

◆ setAsCategory()

FormSetupItem::setAsCategory ( $catType)

Set type of input as a category selector TODO add default value.

Parameters
string$catTypeType of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
Returns
self

Definition at line 1711 of file html.formsetup.class.php.

References type.

◆ setAsColor()

FormSetupItem::setAsColor ( )

Set type of input as color.

Returns
self

Definition at line 1609 of file html.formsetup.class.php.

References type.

◆ setAsEmail()

FormSetupItem::setAsEmail ( )

Set type of input as string.

Returns
self

Definition at line 1587 of file html.formsetup.class.php.

References type.

◆ setAsEmailTemplate()

FormSetupItem::setAsEmailTemplate ( $templateType)

Set type of input as emailtemplate selector.

Parameters
string$templateTypeemail template type
Returns
self

Definition at line 1643 of file html.formsetup.class.php.

References type.

◆ setAsGenericPassword()

FormSetupItem::setAsGenericPassword ( )

Set type of input as a generic password without dolibarr password rules (for external passwords for example).

Hide entry on display.

Returns
self
See also
setAsPassword()

Definition at line 1820 of file html.formsetup.class.php.

References type.

◆ setAsHtml()

FormSetupItem::setAsHtml ( )

Set type of input as html editor.

Returns
self

Definition at line 1631 of file html.formsetup.class.php.

References type.

◆ setAsMultiSelect()

FormSetupItem::setAsMultiSelect ( $fieldOptions)

Set type of input as a multiselect list.

Parameters
array<int|string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}>$fieldOptions A table of field options
Returns
self

Definition at line 1735 of file html.formsetup.class.php.

References type.

◆ setAsNumber()

FormSetupItem::setAsNumber ( $min = null,
$max = null,
$step = null )

Set type of input as number.

Parameters
int$minminimum value for input number
int$maxmaximum value for input number
int$steplegal number intervals
Returns
self

Definition at line 1565 of file html.formsetup.class.php.

References type.

◆ setAsPassword()

FormSetupItem::setAsPassword ( )

Set type of input as a password with dolibarr password rules apply.

Hide entry on display.

Returns
self
See also
setAsGenericPassword()

Definition at line 1807 of file html.formsetup.class.php.

References type.

◆ setAsPrice()

FormSetupItem::setAsPrice ( )

Set type of input as product.

Returns
self

Definition at line 1698 of file html.formsetup.class.php.

References type.

◆ setAsProduct()

FormSetupItem::setAsProduct ( )

Set type of input as product.

Returns
self

Definition at line 1687 of file html.formsetup.class.php.

References type.

◆ setAsRadio()

FormSetupItem::setAsRadio ( $fieldOptions)

Set type of input as a radio button.

Parameters
?array<int|string,string|array{id:string,label:string,picto?:string,labelIsHtml?:bool}>$fieldOptions A table of field options
Returns
self

Definition at line 1768 of file html.formsetup.class.php.

References type.

◆ setAsSecureKey()

FormSetupItem::setAsSecureKey ( )

Set type of input as secure key.

Returns
self

Definition at line 1676 of file html.formsetup.class.php.

References type.

◆ setAsSelect()

FormSetupItem::setAsSelect ( $fieldOptions)

Set type of input as a select list.

Parameters
?array<int|string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string,note:string}>$fieldOptions A table of field options
Returns
self

Definition at line 1751 of file html.formsetup.class.php.

References type.

◆ setAsSelectBankAccount()

FormSetupItem::setAsSelectBankAccount ( )

Set type of input as a bank account selection from dolibarr bank accounts list.

Returns
self

Definition at line 1794 of file html.formsetup.class.php.

References type.

◆ setAsSelectUser()

FormSetupItem::setAsSelectUser ( )

Set type of input as a selection of a user from dolibarr users list.

Returns
self

Definition at line 1783 of file html.formsetup.class.php.

References type.

◆ setAsString()

FormSetupItem::setAsString ( )

Set type of input as string.

Returns
self

Definition at line 1551 of file html.formsetup.class.php.

References type.

◆ setAsTextarea()

FormSetupItem::setAsTextarea ( )

Set type of input as textarea.

Returns
self

Definition at line 1620 of file html.formsetup.class.php.

References type.

◆ setAsThirdpartyType()

FormSetupItem::setAsThirdpartyType ( )

Set type of input as thirdparty_type selector.

Returns
self

Definition at line 1654 of file html.formsetup.class.php.

References type.

◆ setAsTitle()

FormSetupItem::setAsTitle ( )

Set type of input as a simple title.

No data to store

Returns
self

Definition at line 1722 of file html.formsetup.class.php.

References type.

◆ setAsUrl()

FormSetupItem::setAsUrl ( )

Set type of input as string.

Returns
self

Definition at line 1598 of file html.formsetup.class.php.

References type.

◆ setAsYesNo()

FormSetupItem::setAsYesNo ( )

Set type of input as Yes.

Returns
self

Definition at line 1665 of file html.formsetup.class.php.

References type.

◆ setErrors()

FormSetupItem::setErrors ( $errors)

Add error.

Parameters
string[] | string$errorsthe error text
Returns
null

Definition at line 1314 of file html.formsetup.class.php.

◆ setSaveCallBack()

FormSetupItem::setSaveCallBack ( callable $callBack)

Set an override function for saving data.

Parameters
callable$callBacka callable function
Returns
void

Definition at line 814 of file html.formsetup.class.php.

◆ setTypeFromTypeString()

FormSetupItem::setTypeFromTypeString ( $type)

set the type from string : used for old module builder setup conf style conversion and tests because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist to be sure we can manage evolution easily

Parameters
string$typePossible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie\TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
Deprecated
this setTypeFromTypeString came deprecated because it exists only for manage setup conversion
Returns
bool

Definition at line 1301 of file html.formsetup.class.php.

References type.

◆ setValueFromPost()

FormSetupItem::setValueFromPost ( )

Save const value based on htdocs/core/actions_setmoduleoptions.inc.php.

Returns
int -1 if KO, 0 nothing to do , 1 if OK

Definition at line 835 of file html.formsetup.class.php.

References GETPOST(), GETPOSTINT(), and type.

◆ setValueFromPostCallBack()

FormSetupItem::setValueFromPostCallBack ( callable $callBack)

Set an override function for get data from post.

Parameters
callable$callBacka callable function
Returns
void

Definition at line 825 of file html.formsetup.class.php.


The documentation for this class was generated from the following file: