19declare(strict_types=1);
33 return $lng->txt(
'udf_type_select');
44 'allow_multiple' => $ff->checkbox(
$lng->txt(
'multiple_selection'))
45 ->withValue($parsed_data[
'allow_multiple']),
46 'options' => $ff->tag(
$lng->txt(
'udf_select_options'), [])
47 ->withValue($parsed_data[
'options'])
48 ])->withAdditionalTransformation(
50 static fn(array $vs):
string => json_encode([
51 'allow_multiple' => $vs[
'allow_multiple'],
52 'options' => $vs[
'options']
65 $parsed_data = $this->parseData(
$data);
66 if (!$parsed_data[
'allow_multiple']) {
67 $input = new \ilSelectInputGUI($label);
69 [
'' =>
$lng->txt(
'please_select')]
70 + array_combine($parsed_data[
'options'], $parsed_data[
'options'])
72 $input->setValue($user_value[0] ??
'');
76 $input = new \ilMultiSelectInputGUI($label);
78 array_combine($parsed_data[
'options'], $parsed_data[
'options'])
80 $input->setValue($user_value);
89 if (!is_array($input)) {
95 fn(
string $v):
bool => in_array($v,
$options)
101 if (
$data ===
null) {
103 'allow_multiple' =>
false,
108 $values = json_decode(
$data,
true) ?? unserialize(
$data, [
'allowed_classes' =>
false]) ?? [];
111 'allow_multiple' => $values[
'allow_multiple'] ??
false,
112 'options' => $values[
'options'] ?? $values
getAdditionalEditFormInputs(Language $lng, FieldFactory $ff, Refinery $refinery, ?string $data)
MAY return a valid FormInput that will be added to the form to edit/create the custom field to specif...
getLegacyInput(Language $lng, Context $context, array $user_value, string $label, ?string $data)
MUST return a ilFormPropertyGUI to be shown to the user when entering the information.
prepareUserInputForStorage(mixed $input, ?string $data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...