forked from Wavyzz/dolibarr
Fix use css of setup text item when fieldAttr are also provided
This commit is contained in:
@@ -449,12 +449,12 @@ class FormSetup
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new item
|
* 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 $confKey the conf key used in database
|
||||||
* @param string $targetItemKey target item used to place the new item beside
|
* @param string $targetItemKey target item used to place the new item beside
|
||||||
* @param bool $insertAfterTarget insert before or after target item ?
|
* @param bool $insertAfterTarget insert before or after target item ?
|
||||||
* @return FormSetupItem the new setup item created
|
* @return FormSetupItem the new setup item created
|
||||||
*/
|
*/
|
||||||
public function newItem($confKey, $targetItemKey = '', $insertAfterTarget = false)
|
public function newItem($confKey, $targetItemKey = '', $insertAfterTarget = false)
|
||||||
{
|
{
|
||||||
@@ -911,7 +911,7 @@ class FormSetupItem
|
|||||||
*/
|
*/
|
||||||
public function generateInputFieldText()
|
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);
|
$this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass);
|
||||||
}
|
}
|
||||||
return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
|
return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ $item->cssClass = 'minwidth500';
|
|||||||
// Setup conf for selection of a simple string input
|
// Setup conf for selection of a simple string input
|
||||||
$item = $formSetup->newItem('MYMODULE_MYPARAM2');
|
$item = $formSetup->newItem('MYMODULE_MYPARAM2');
|
||||||
$item->defaultFieldValue = 'default value';
|
$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
|
// Setup conf for selection of a simple textarea input but we replace the text of field title
|
||||||
$item = $formSetup->newItem('MYMODULE_MYPARAM3');
|
$item = $formSetup->newItem('MYMODULE_MYPARAM3');
|
||||||
|
|||||||
Reference in New Issue
Block a user