forked from Wavyzz/dolibarr
Merge pull request #20950 from atm-john/new_form_setup_color
Fix backport for 16 and ADD color, default value ,
This commit is contained in:
@@ -240,7 +240,7 @@ if ($dirins && $action == 'initmodule' && $modulename) {
|
||||
|
||||
// Copy last html.formsetup.class.php' to backport folder
|
||||
$tryToCopyFromSetupClass = true;
|
||||
$backportDest = $destdir .'/backport/v17/core/class';
|
||||
$backportDest = $destdir .'/backport/v16/core/class';
|
||||
$backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
||||
$backportFileDest = $backportDest.'/html.formsetup.class.php';
|
||||
$result = dol_mkdir($backportDest);
|
||||
|
||||
@@ -88,7 +88,7 @@ $useFormSetup = 1;
|
||||
if (!class_exists('FormSetup')) {
|
||||
// For retrocompatibility Dolibarr < 16.0
|
||||
if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) {
|
||||
require_once __DIR__.'/../backport/v17/core/class/html.formsetup.class.php';
|
||||
require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php';
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
||||
}
|
||||
@@ -104,6 +104,7 @@ $item->cssClass = 'minwidth500';
|
||||
|
||||
// Setup conf MYMODULE_MYPARAM1 as a simple string input
|
||||
$item = $formSetup->newItem('MYMODULE_MYPARAM1');
|
||||
$item->defaultFieldValue = 'default value';
|
||||
|
||||
// Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title
|
||||
$item = $formSetup->newItem('MYMODULE_MYPARAM2');
|
||||
@@ -145,6 +146,20 @@ $item->helpText = $langs->transnoentities('MYMODULE_MYPARAM8');
|
||||
$formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField);
|
||||
|
||||
|
||||
// Setup conf MYMODULE_MYPARAM10
|
||||
$item = $formSetup->newItem('MYMODULE_MYPARAM10');
|
||||
$item->setAsColor();
|
||||
$item->defaultFieldValue = '#FF0000';
|
||||
$item->nameText = $item->getNameText().' more html text ';
|
||||
$item->fieldInputOverride = '';
|
||||
$item->helpText = $langs->transnoentities('AnHelpMessage');
|
||||
//$item->fieldValue = '';
|
||||
//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
|
||||
//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
|
||||
//$item->fieldInputOverride = false; // set this var to override field input
|
||||
//$item->fieldOutputOverride = false; // set this var to override field output
|
||||
|
||||
|
||||
$setupnotempty =+ count($formSetup->items);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user