2
0
forked from Wavyzz/dolibarr

Fix use css of setup text item when fieldAttr are also provided

This commit is contained in:
Laurent Destailleur
2024-01-23 16:28:36 +01:00
parent b177e68d04
commit a7378be744
2 changed files with 4 additions and 3 deletions

View File

@@ -449,7 +449,7 @@ class FormSetup
/**
* Create a new item
* the tagret is useful with hooks : that allow externals modules to add setup items on good place
* The tagret is useful with hooks : that allow externals modules to add setup items on good place
*
* @param string $confKey the conf key used in database
* @param string $targetItemKey target item used to place the new item beside
@@ -911,7 +911,7 @@ class FormSetupItem
*/
public function generateInputFieldText()
{
if (empty($this->fieldAttr)) {
if (empty($this->fieldAttr) || empty($this->fieldAttr['class'])) {
$this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass);
}
return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';

View File

@@ -102,6 +102,7 @@ $item->cssClass = 'minwidth500';
// Setup conf for selection of a simple string input
$item = $formSetup->newItem('MYMODULE_MYPARAM2');
$item->defaultFieldValue = 'default value';
$item->fieldAttr['placeholder'] = 'A placehoder here';
// Setup conf for selection of a simple textarea input but we replace the text of field title
$item = $formSetup->newItem('MYMODULE_MYPARAM3');