Commit d7dfe24d authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F8719extraButtonLockAddSupportFor01' into 'master'

Fixes #8179 - extraButtonLock and extraButtonPassword might be specified...

See merge request !168
parents 1269f527 875b008e
Pipeline #2113 passed with stages
in 2 minutes and 30 seconds
......@@ -2964,9 +2964,9 @@ See also at specific *FormElement* definitions.
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| htmlBefore | string | HTML Code wrapped before the complete *FormElement* |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| extraButtonLock | none | No value. Show a 'lock' on the right side of the input element. See `extraButtonLock`_ |
| extraButtonLock | none | [0|1] Show a 'lock' on the right side of the input element. See `extraButtonLock`_ |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| extraButtonPassword | none | No value. Show an 'eye' on the right side of the input element. See `extraButtonPassword`_ |
| extraButtonPassword | none | [0|1] Show an 'eye' on the right side of the input element. See `extraButtonPassword`_ |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| extraButtonInfo | string | Text. Show an 'i' on the right side of the input element. See `extraButtonInfo`_ |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
......
......@@ -405,8 +405,7 @@ EOF;
$skip = (!($formElement[FE_MODE] == FE_MODE_SHOW || $formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED));
// LOCK
if (!$skip && isset($formElement[FE_INPUT_EXTRA_BUTTON_LOCK])) {
if (!$skip && HelperFormElement::booleParameter($formElement[FE_INPUT_EXTRA_BUTTON_LOCK] ?? '-')) {
$formElement[FE_MODE] = FE_MODE_READONLY;
$extraButton .= <<<EOF
......@@ -418,7 +417,8 @@ EOF;
}
// PASSWORD
if (!$skip && isset($formElement[FE_INPUT_EXTRA_BUTTON_PASSWORD])) {
// if (!$skip && isset($formElement[FE_INPUT_EXTRA_BUTTON_PASSWORD])) {
if (!$skip && HelperFormElement::booleParameter($formElement[FE_INPUT_EXTRA_BUTTON_PASSWORD] ?? '-')) {
$formElement[FE_TYPE] = 'password';
......@@ -508,4 +508,22 @@ EOF;
return $classArr;
}
/**
* Function to check if a parameter is set (no value) or 0 or 1
* Example:
* a) extraButtonLock
* b) extraButtonLock=0
* c) extraButtonLock=1
*
* a) and c) means 'on' and b) means off
*
* IMPORTANT: Call this function : HelperFormElement::booleParameter( $fe[FE_INPUT_EXTRA_BUTTON_LOCK] ?? '-' )
*
* @param $data
* @return bool
*/
public static function booleParameter($data) {
return $data == '' || $data == '1';
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment