Merge pull request #21465 from jyhere/jyhere-patch-1

ADD multiselect support in Form::formconfirm()
This commit is contained in:
Laurent Destailleur 2022-07-07 20:49:04 +02:00 committed by GitHub
commit 47924e5c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4911,7 +4911,7 @@ class Form
* @param string $question Question
* @param string $action Action
* @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>))
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', 'other' or 'onecolumn'...
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'select', 'multiselect', 'morecss', 'other' or 'onecolumn'...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
* @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int|string $height Force height of box (0 = auto)
@ -4982,7 +4982,7 @@ class Form
$moreonecolumn .= $input['value'];
$moreonecolumn .= '</textarea>';
$moreonecolumn .= '</div>';
} elseif ($input['type'] == 'select') {
} elseif (in_array($input['type'], ['select', 'multiselect'])) {
if (empty($morecss)) {
$morecss = 'minwidth100';
}
@ -4999,7 +4999,11 @@ class Form
if (!empty($input['label'])) {
$more .= $input['label'].'</div><div class="tagtd left">';
}
$more .= $this->selectarray($input['name'], $input['values'], isset($input['default'])?$input['default']:'', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
if ($input['type'] == 'select') {
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
} else {
$more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr);
}
$more .= '</div></div>'."\n";
} elseif ($input['type'] == 'checkbox') {
$more .= '<div class="tagtr">';