Skip to content

Commit d4ca84d

Browse files
authored
Merge pull request #6363 from christianbeeznest/uco-22714
Internal: Add labels to addmultiselect element for formvalidator - refs BT#22714
2 parents d082745 + 1b7e003 commit d4ca84d

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

main/inc/lib/pear/HTML/QuickForm/advmultiselect.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,14 @@ public function toHtml()
773773
$leftAll = "<br /><br /><button $attrStrAdd /> <em class='fa fa-backward'></em></button>";
774774
}
775775

776+
$strHtmlAdd = "<div class='d-flex justify-content-center align-items-center' style='height: 100%; padding-top: 100px;'>
777+
<button $attrStrAdd><em class='fa fa-arrow-right'></em></button>
778+
</div>";
779+
780+
$strHtmlRemove = "<div class='d-flex justify-content-center align-items-center' style='padding-top: 10px;'>
781+
<button $attrStrRemove><em class='fa fa-arrow-left'></em></button>
782+
</div>";
783+
776784
// build the select all button with all its attributes
777785
$strHtmlAll = '';
778786

@@ -925,7 +933,7 @@ public function getElementJs($raw = true, $min = true)
925933
left: \''.$search.'\',
926934
right: \''.$search.'\'
927935
},
928-
fireSearch: function(value) {
936+
fireSearch: function(value) {
929937
return value.length > 2;
930938
}
931939
});

main/inc/lib/pear/HTML/QuickForm/select.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,21 @@ public function getTemplate($layout)
581581
</div>';
582582
break;
583583
case FormValidator::LAYOUT_HORIZONTAL:
584+
if ($this instanceof HTML_QuickForm_advmultiselect) {
585+
return '
586+
<div class="form-group {error_class}">
587+
<label {label-for} class="col-sm-'.$size[0].' control-label {extra_label_class}">
588+
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
589+
{label}
590+
</label>
591+
<div class="col-sm-'.$size[1].'">
592+
{icon}
593+
{element}
594+
<!-- BEGIN error --><span class="help-inline help-block">{error}</span><!-- END error -->
595+
</div>
596+
</div>';
597+
}
598+
584599
return '
585600
<div class="form-group {error_class}">
586601
<label {label-for} class="col-sm-'.$size[0].' control-label {extra_label_class}" >

main/lp/lp_subscribe_users.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,15 @@
113113
$userMultiSelect = $formUsers->addElement(
114114
'advmultiselect',
115115
'users',
116-
get_lang('Users'),
116+
null,
117117
$choices
118118
);
119+
120+
$userMultiSelect->setLabel([
121+
get_lang('Users'),
122+
get_lang('NotSubscribed'),
123+
get_lang('Subscribed'),
124+
]);
119125
$formUsers->addButtonSave(get_lang('Save'));
120126

121127
$defaults = [];
@@ -161,10 +167,15 @@
161167
$groupMultiSelect = $form->addElement(
162168
'advmultiselect',
163169
'groups',
164-
get_lang('Groups'),
170+
null,
165171
$groupChoices
166172
);
167173

174+
$groupMultiSelect->setLabel([
175+
get_lang('Groups'),
176+
get_lang('NotSubscribed'),
177+
get_lang('Subscribed'),
178+
]);
168179
$form->addButtonSave(get_lang('Save'));
169180

170181
// UserGroup

0 commit comments

Comments
 (0)