Skip to content

Commit d170c79

Browse files
committed
fix(ldapselectfield): no translation for items
1 parent 028a2b9 commit d170c79

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

inc/field/ldapselectfield.class.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,35 @@ public function showForm(array $options): void {
5858
]);
5959
}
6060

61+
public function getRenderedHtml($domain, $canEdit = true): string {
62+
if (!$canEdit) {
63+
return $this->value . PHP_EOL;
64+
}
65+
66+
$html = '';
67+
$id = $this->question->getID();
68+
$rand = mt_rand();
69+
$fieldName = 'formcreator_field_' . $id;
70+
$values = $this->getAvailableValues();
71+
72+
if (!empty($this->question->fields['values'])) {
73+
$html .= Dropdown::showFromArray($fieldName, $values, [
74+
'display_emptychoice' => $this->question->fields['show_empty'] == 1,
75+
'value' => $this->value,
76+
'values' => [],
77+
'rand' => $rand,
78+
'multiple' => false,
79+
'display' => false,
80+
]);
81+
}
82+
$html .= PHP_EOL;
83+
$html .= Html::scriptBlock("$(function() {
84+
pluginFormcreatorInitializeSelect('$fieldName', '$rand');
85+
});");
86+
87+
return $html;
88+
}
89+
6190
public function getAvailableValues() {
6291
if (empty($this->question->fields['values'])) {
6392
return [];

0 commit comments

Comments
 (0)