FormSetup
class FormSetup (View source)
This class help you create setup render.
See Example in modulebuilder/template/admin/setup.php to know how to use this utility class.
Properties
| DoliDB | $db | ||
| int | $entity | ||
| FormSetupItem[] | $items | ||
| int | $setupNotEmpty | ||
| Translate | $langs | ||
| Form | $form | ||
| protected int | $maxItemRank | ||
| string | $htmlBeforeOutputForm | Html string display before output form |
|
| string | $htmlAfterOutputForm | Html string to display after output form |
|
| string | $htmlOutputMoreButton | Html string to display on buttons zone |
|
| array<string, string> | $formAttributes | ||
| array<string, string> | $formHiddenInputs | an list of hidden inputs used only in edit mode |
|
| string[] | $errors |
Methods
Generate an attributes string form an input array
Generate the form (in read or edit mode depending on $editMode)
generateTableOutput
saveConfFromPost
Method used to test module builder conversion to this form usage
From old Method was used to test module builder conversion to this form usage.
Used to export param array for /core/actions_setmoduleoptions.inc.php template Method exists only for manage setup conversion
Reload for each item default conf note: this will override custom configuration
Create a new item The target is useful with hooks : that allow externals modules to add setup items on good place
Sort items according to rank
getCurentItemMaxRank
set new max rank if needed
get item position rank from item key
Details
__construct(DoliDB $db, Translate $outputLangs = null)
Constructor
static string
generateAttributesStringFromArray(array<string, mixed|mixed[]|object> $attributes)
Generate an attributes string form an input array
string
generateOutput(bool $editMode = false, bool $hideTitle = false, string $title = '', string $cssfirstcolumn = '')
Generate the form (in read or edit mode depending on $editMode)
string
generateTableOutput(bool $editMode = false, bool $hideTitle = false, string $title = '', string $cssfirstcolumn = '')
generateTableOutput
int|null
saveConfFromPost(bool $noMessageInUpdate = false)
saveConfFromPost
string
generateLineOutput(FormSetupItem $item, bool $editMode = false)
generateLineOutput
bool
addItemsFromParamsArray(array<array<string, null|int|float|string>> $params)
Method used to test module builder conversion to this form usage
bool
addItemFromParams(string $confKey, array<string, null|int|float|string> $params)
From old Method was used to test module builder conversion to this form usage.
array<string, array{type: string, enabled: int<0, 1>}>
exportItemsAsParamsArray()
Used to export param array for /core/actions_setmoduleoptions.inc.php template Method exists only for manage setup conversion
bool
reloadConfs()
Reload for each item default conf note: this will override custom configuration
FormSetupItem
newItem(string $confKey, string $targetItemKey = '', bool $insertAfterTarget = false)
Create a new item The target is useful with hooks : that allow externals modules to add setup items on good place
bool
sortingItems()
Sort items according to rank
int
getCurentItemMaxRank(bool $cache = true)
getCurentItemMaxRank
void
setItemMaxRank(int $rank)
set new max rank if needed
int
getLineRank(string $itemKey)
get item position rank from item key
itemSort(FormSetupItem $a, FormSetupItem $b)
uasort callback function to Sort params items
@param FormSetupItem $a formSetup item